1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-01 01:04:50 +03:00

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
This commit is contained in:
David Rowley 2022-08-26 02:46:56 +12:00
parent 3e0fff2e68
commit d389487525

View File

@ -543,8 +543,7 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
GISTNodeBuffer *nodeBuffer; GISTNodeBuffer *nodeBuffer;
BlockNumber blocknum; BlockNumber blocknum;
IndexTuple itup; IndexTuple itup;
int splitPagesCount = 0, int splitPagesCount = 0;
i;
GISTENTRY entry[INDEX_MAX_KEYS]; GISTENTRY entry[INDEX_MAX_KEYS];
bool isnull[INDEX_MAX_KEYS]; bool isnull[INDEX_MAX_KEYS];
GISTNodeBuffer oldBuf; GISTNodeBuffer oldBuf;
@ -595,11 +594,11 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
* Fill relocation buffers information for node buffers of pages produced * Fill relocation buffers information for node buffers of pages produced
* by split. * by split.
*/ */
i = 0;
foreach(lc, splitinfo) foreach(lc, splitinfo)
{ {
GISTPageSplitInfo *si = (GISTPageSplitInfo *) lfirst(lc); GISTPageSplitInfo *si = (GISTPageSplitInfo *) lfirst(lc);
GISTNodeBuffer *newNodeBuffer; GISTNodeBuffer *newNodeBuffer;
int i = foreach_current_index(lc);
/* Decompress parent index tuple of node buffer page. */ /* Decompress parent index tuple of node buffer page. */
gistDeCompressAtt(giststate, r, gistDeCompressAtt(giststate, r,
@ -618,8 +617,6 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
relocationBuffersInfos[i].nodeBuffer = newNodeBuffer; relocationBuffersInfos[i].nodeBuffer = newNodeBuffer;
relocationBuffersInfos[i].splitinfo = si; relocationBuffersInfos[i].splitinfo = si;
i++;
} }
/* /*