aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAgg.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2022-08-24 12:27:12 +1200
committerDavid Rowley <drowley@postgresql.org>2022-08-24 12:27:12 +1200
commit421892a192b8f95ab96c5edb61d424f80a4221d0 (patch)
tree74b077cee1c0c21fef0faec5ff0a63d050f991ca /src/backend/executor/nodeAgg.c
parent869e56a39976a42a393adc2d69df3abce7eff18f (diff)
downloadpostgresql-421892a192b8f95ab96c5edb61d424f80a4221d0.tar.gz
postgresql-421892a192b8f95ab96c5edb61d424f80a4221d0.zip
Further reduce warnings with -Wshadow=compatible-local
In a similar effort to f01592f91, here we're targetting fixing the warnings that -Wshadow=compatible-local produces that we can fix by moving a variable to an inner scope to stop that variable from being shadowed by another variable declared somewhere later in the function. All of the warnings being fixed here are changing the scope of variables which are being used as an iterator for a "for" loop. In each instance, the fix happens to be changing the for loop to use the C99 type initialization. Much of this code likely pre-dates our use of C99. Reducing the scope of the outer scoped variable seems like the safest way to fix these. Renaming seems more likely to risk patches using the wrong variable. Reducing the scope is more likely to result in a compilation failure after applying some future patch rather than introducing bugs with it. By my count, this takes the warning count from 129 down to 114. Author: Justin Pryzby Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r--src/backend/executor/nodeAgg.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 96d200e4461..933c3049016 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -1296,13 +1296,12 @@ finalize_aggregates(AggState *aggstate,
Datum *aggvalues = econtext->ecxt_aggvalues;
bool *aggnulls = econtext->ecxt_aggnulls;
int aggno;
- int transno;
/*
* If there were any DISTINCT and/or ORDER BY aggregates, sort their
* inputs and run the transition functions.
*/
- for (transno = 0; transno < aggstate->numtrans; transno++)
+ for (int transno = 0; transno < aggstate->numtrans; transno++)
{
AggStatePerTrans pertrans = &aggstate->pertrans[transno];
AggStatePerGroup pergroupstate;