Skip to content

Commit b5934bf

Browse files
committed
Fix some shadow variables in src/backend/replication/
The code is able to compile already without warnings under -Wshadow=compatible-local, which is itself already enabled in the tree, and the ones fixed here showed up with the more restrictive -Wshadow. There are more of these that we may want to look at, and the ones fixed here made the code confusing. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+PuR0y4ofNOxi691VTVWmBfScHV9AaBMGSpeh8+DKp81Nw@mail.gmail.com
1 parent d0fe304 commit b5934bf

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/backend/replication/logical/logicalfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin
181181

182182
for (i = 0; i < nelems; i += 2)
183183
{
184-
char *name = TextDatumGetCString(datum_opts[i]);
184+
char *optname = TextDatumGetCString(datum_opts[i]);
185185
char *opt = TextDatumGetCString(datum_opts[i + 1]);
186186

187-
options = lappend(options, makeDefElem(name, (Node *) makeString(opt), -1));
187+
options = lappend(options, makeDefElem(optname, (Node *) makeString(opt), -1));
188188
}
189189
}
190190

src/backend/replication/logical/reorderbuffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,16 +4840,16 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
48404840
/* stitch toast tuple back together from its parts */
48414841
dlist_foreach(it, &ent->chunks)
48424842
{
4843-
bool isnull;
4843+
bool cisnull;
48444844
ReorderBufferChange *cchange;
48454845
ReorderBufferTupleBuf *ctup;
48464846
Pointer chunk;
48474847

48484848
cchange = dlist_container(ReorderBufferChange, node, it.cur);
48494849
ctup = cchange->data.tp.newtuple;
4850-
chunk = DatumGetPointer(fastgetattr(&ctup->tuple, 3, toast_desc, &isnull));
4850+
chunk = DatumGetPointer(fastgetattr(&ctup->tuple, 3, toast_desc, &cisnull));
48514851

4852-
Assert(!isnull);
4852+
Assert(!cisnull);
48534853
Assert(!VARATT_IS_EXTERNAL(chunk));
48544854
Assert(!VARATT_IS_SHORT(chunk));
48554855

src/backend/replication/walsender.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,7 +3540,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
35403540
for (i = 0; i < max_wal_senders; i++)
35413541
{
35423542
WalSnd *walsnd = &WalSndCtl->walsnds[i];
3543-
XLogRecPtr sentPtr;
3543+
XLogRecPtr sent_ptr;
35443544
XLogRecPtr write;
35453545
XLogRecPtr flush;
35463546
XLogRecPtr apply;
@@ -3564,7 +3564,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
35643564
continue;
35653565
}
35663566
pid = walsnd->pid;
3567-
sentPtr = walsnd->sentPtr;
3567+
sent_ptr = walsnd->sentPtr;
35683568
state = walsnd->state;
35693569
write = walsnd->write;
35703570
flush = walsnd->flush;
@@ -3607,9 +3607,9 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
36073607
{
36083608
values[1] = CStringGetTextDatum(WalSndGetStateString(state));
36093609

3610-
if (XLogRecPtrIsInvalid(sentPtr))
3610+
if (XLogRecPtrIsInvalid(sent_ptr))
36113611
nulls[2] = true;
3612-
values[2] = LSNGetDatum(sentPtr);
3612+
values[2] = LSNGetDatum(sent_ptr);
36133613

36143614
if (XLogRecPtrIsInvalid(write))
36153615
nulls[3] = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy