Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d389487

Browse files
committed
Small refactor to get rid of -Wshadow=compatible-local warning
Further reduce -Wshadow=compatible-local warnings by 1 by refactoring the code in gistRelocateBuildBuffersOnSplit() to make use of foreach_current_index() instead of manually incrementing a variable on each loop. Author: David Rowley Discussion: https://postgr.es/m/CAApHDvpGZX-X=Bn4moyXgfFa0CdSUwoa04d3isit3=1qo8F8Bw@mail.gmail.com
1 parent 3e0fff2 commit d389487

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/backend/access/gist/gistbuildbuffers.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,7 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
543543
GISTNodeBuffer *nodeBuffer;
544544
BlockNumber blocknum;
545545
IndexTuple itup;
546-
int splitPagesCount = 0,
547-
i;
546+
int splitPagesCount = 0;
548547
GISTENTRY entry[INDEX_MAX_KEYS];
549548
bool isnull[INDEX_MAX_KEYS];
550549
GISTNodeBuffer oldBuf;
@@ -595,11 +594,11 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
595594
* Fill relocation buffers information for node buffers of pages produced
596595
* by split.
597596
*/
598-
i = 0;
599597
foreach(lc, splitinfo)
600598
{
601599
GISTPageSplitInfo *si = (GISTPageSplitInfo *) lfirst(lc);
602600
GISTNodeBuffer *newNodeBuffer;
601+
int i = foreach_current_index(lc);
603602

604603
/* Decompress parent index tuple of node buffer page. */
605604
gistDeCompressAtt(giststate, r,
@@ -618,8 +617,6 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
618617

619618
relocationBuffersInfos[i].nodeBuffer = newNodeBuffer;
620619
relocationBuffersInfos[i].splitinfo = si;
621-
622-
i++;
623620
}
624621

625622
/*

0 commit comments

Comments
 (0)