Declare loop variables inside for loop declaration where possible.

PiperOrigin-RevId: 518846098
Change-Id: Icdb2e5894bd80110552e29270472eeb242e6cf2c
This commit is contained in:
Nimrod Gileadi
2023-03-23 06:48:32 -07:00
committed by Copybara-Service
parent ce6c9053e2
commit 145fe7f354
9 changed files with 111 additions and 107 deletions
+2 -1
View File
@@ -105,7 +105,7 @@ static void ARdiaginv(const mjModel* m, mjData* d, mjtNum* res, int flg_subR) {
// extract diagonal block from AR, clamp diag to 1e-10 if flg_subR
static void extractBlock(const mjModel* m, mjData* d, mjtNum* Ac,
int start, int n, int flg_subR) {
int k, nefc = d->nefc;
int nefc = d->nefc;
const mjtNum *AR = d->efc_AR;
const int *rownnz = d->efc_AR_rownnz, *rowadr = d->efc_AR_rowadr, *colind = d->efc_AR_colind;
@@ -123,6 +123,7 @@ static void extractBlock(const mjModel* m, mjData* d, mjtNum* Ac,
}
*/
// assume full sub-matrix, find starting k: same for all rows
int k;
for (k=0; k<rownnz[start]; k++) {
if (colind[rowadr[start]+k]==start) {
break;