diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c index 524c1846b8..a581659fe2 100644 --- a/src/backend/access/brin/brin_minmax_multi.c +++ b/src/backend/access/brin/brin_minmax_multi.c @@ -620,14 +620,18 @@ brin_range_serialize(Ranges *range) */ if (typlen == -1) /* varlena */ { - for (int i = 0; i < nvalues; i++) + int i; + + for (i = 0; i < nvalues; i++) { len += VARSIZE_ANY(range->values[i]); } } else if (typlen == -2) /* cstring */ { - for (int i = 0; i < nvalues; i++) + int i; + + for (i = 0; i < nvalues; i++) { /* don't forget to include the null terminator ;-) */ len += strlen(DatumGetCString(range->values[i])) + 1; diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index f9d40fa1a0..1545ff9f16 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -1650,16 +1650,16 @@ interpret_ident_response(const char *ident_response, return false; else { - int j; /* Index into *ident_user */ + int i; /* Index into *ident_user */ cursor++; /* Go over colon */ while (pg_isblank(*cursor)) cursor++; /* skip blanks */ /* Rest of line is user name. Copy it over. */ - j = 0; + i = 0; while (*cursor != '\r' && i < IDENT_USERNAME_MAX) - ident_user[j++] = *cursor++; - ident_user[j] = '\0'; + ident_user[i++] = *cursor++; + ident_user[i] = '\0'; return true; } } diff --git a/src/backend/statistics/mcv.c b/src/backend/statistics/mcv.c index 91b9635dc0..6eeacb0d47 100644 --- a/src/backend/statistics/mcv.c +++ b/src/backend/statistics/mcv.c @@ -1861,6 +1861,7 @@ mcv_get_match_bitmap(PlannerInfo *root, List *clauses, { /* AND/OR clause, with all subclauses being compatible */ + int i; BoolExpr *bool_clause = ((BoolExpr *) clause); List *bool_clauses = bool_clause->args; @@ -1879,7 +1880,7 @@ mcv_get_match_bitmap(PlannerInfo *root, List *clauses, * current one. We need to consider if we're evaluating AND or OR * condition when merging the results. */ - for (int i = 0; i < mcvlist->nitems; i++) + for (i = 0; i < mcvlist->nitems; i++) matches[i] = RESULT_MERGE(matches[i], is_or, bool_matches[i]); pfree(bool_matches); @@ -1888,6 +1889,7 @@ mcv_get_match_bitmap(PlannerInfo *root, List *clauses, { /* NOT clause, with all subclauses compatible */ + int i; BoolExpr *not_clause = ((BoolExpr *) clause); List *not_args = not_clause->args; @@ -1906,7 +1908,7 @@ mcv_get_match_bitmap(PlannerInfo *root, List *clauses, * current one. We're handling a NOT clause, so invert the result * before merging it into the global bitmap. */ - for (int i = 0; i < mcvlist->nitems; i++) + for (i = 0; i < mcvlist->nitems; i++) matches[i] = RESULT_MERGE(matches[i], is_or, !not_matches[i]); pfree(not_matches); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index c0d09edf9d..ca4ad07004 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -11775,10 +11775,11 @@ dumpFunc(Archive *fout, const FuncInfo *finfo) if (*protrftypes) { Oid *typeids = palloc(FUNC_MAX_ARGS * sizeof(Oid)); + int i; appendPQExpBufferStr(q, " TRANSFORM "); parseOidArray(protrftypes, typeids, FUNC_MAX_ARGS); - for (int i = 0; typeids[i]; i++) + for (i = 0; typeids[i]; i++) { if (i != 0) appendPQExpBufferStr(q, ", "); diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c index b666c90908..35e7b92da4 100644 --- a/src/interfaces/ecpg/pgtypeslib/numeric.c +++ b/src/interfaces/ecpg/pgtypeslib/numeric.c @@ -1180,6 +1180,7 @@ PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result) { if (divisor[guess].buf == NULL) { + int i; long sum = 0; memcpy(&divisor[guess], &divisor[1], sizeof(numeric)); @@ -1187,7 +1188,7 @@ PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result) if (divisor[guess].buf == NULL) goto done; divisor[guess].digits = divisor[guess].buf; - for (int i = divisor[1].ndigits - 1; i >= 0; i--) + for (i = divisor[1].ndigits - 1; i >= 0; i--) { sum += divisor[1].digits[i] * guess; divisor[guess].digits[i] = sum % 10;