summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gist.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/access/gist/gist.c
parent869e56a39976a42a393adc2d69df3abce7eff18f (diff)
downloadpostgresql-421892a192b8f95ab96c5edb61d424f80a4221d0.tar.gz
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/access/gist/gist.c')
-rw-r--r--src/backend/access/gist/gist.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 5866c6aaaf..30069f139c 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -234,7 +234,6 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
Page page = BufferGetPage(buffer);
bool is_leaf = (GistPageIsLeaf(page)) ? true : false;
XLogRecPtr recptr;
- int i;
bool is_split;
/*
@@ -420,7 +419,7 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
{
char *data = (char *) (ptr->list);
- for (i = 0; i < ptr->block.num; i++)
+ for (int i = 0; i < ptr->block.num; i++)
{
IndexTuple thistup = (IndexTuple) data;