Skip to content

Commit 3e0fff2

Browse files
committed
More -Wshadow=compatible-local warning fixes
In a similar effort to f01592f, here we're targetting fixing the warnings where we've deemed the shadowing variable to serve a close enough purpose to the shadowed variable just to reuse the shadowed version and not declare the shadowing variable at all. By my count, this takes the warning count from 106 down to 71. Author: Justin Pryzby Discussion: https://postgr.es/m/20220825020839.GT2342@telsasoft.com
1 parent e3ce2de commit 3e0fff2

File tree

20 files changed

+8
-51
lines changed

20 files changed

+8
-51
lines changed

src/backend/access/hash/hash_xlog.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ hash_xlog_add_ovfl_page(XLogReaderState *record)
240240
{
241241
Page mappage = (Page) BufferGetPage(mapbuffer);
242242
uint32 *freep = NULL;
243-
char *data;
244243
uint32 *bitmap_page_bit;
245244

246245
freep = HashPageGetBitmap(mappage);

src/backend/access/transam/multixact.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,6 @@ mXactCachePut(MultiXactId multi, int nmembers, MultiXactMember *members)
16141614
if (MXactCacheMembers++ >= MAX_CACHE_ENTRIES)
16151615
{
16161616
dlist_node *node;
1617-
mXactCacheEnt *entry;
16181617

16191618
node = dlist_tail_node(&MXactCache);
16201619
dlist_delete(node);

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,8 +3036,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
30363036
pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_SYNC);
30373037
if (pg_fsync(fd) != 0)
30383038
{
3039-
int save_errno = errno;
3040-
3039+
save_errno = errno;
30413040
close(fd);
30423041
errno = save_errno;
30433042
ereport(ERROR,
@@ -4721,7 +4720,6 @@ XLogInitNewTimeline(TimeLineID endTLI, XLogRecPtr endOfLog, TimeLineID newTLI)
47214720

47224721
if (close(fd) != 0)
47234722
{
4724-
char xlogfname[MAXFNAMELEN];
47254723
int save_errno = errno;
47264724

47274725
XLogFileName(xlogfname, newTLI, startLogSegNo, wal_segment_size);

src/backend/commands/functioncmds.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ compute_return_type(TypeName *returnType, Oid languageOid,
121121
{
122122
char *typnam = TypeNameToString(returnType);
123123
Oid namespaceId;
124-
AclResult aclresult;
125124
char *typname;
126125
ObjectAddress address;
127126

@@ -1112,8 +1111,6 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
11121111
if (languageStruct->lanpltrusted)
11131112
{
11141113
/* if trusted language, need USAGE privilege */
1115-
AclResult aclresult;
1116-
11171114
aclresult = pg_language_aclcheck(languageOid, GetUserId(), ACL_USAGE);
11181115
if (aclresult != ACLCHECK_OK)
11191116
aclcheck_error(aclresult, OBJECT_LANGUAGE,

src/backend/commands/tablecmds.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16796,7 +16796,6 @@ PreCommit_on_commit_actions(void)
1679616796
if (oids_to_drop != NIL)
1679716797
{
1679816798
ObjectAddresses *targetObjects = new_object_addresses();
16799-
ListCell *l;
1680016799

1680116800
foreach(l, oids_to_drop)
1680216801
{

src/backend/commands/vacuum.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
233233
*/
234234
if (!(params.options & VACOPT_ANALYZE))
235235
{
236-
ListCell *lc;
237-
238236
foreach(lc, vacstmt->rels)
239237
{
240238
VacuumRelation *vrel = lfirst_node(VacuumRelation, lc);

src/backend/executor/execPartition.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
768768
{
769769
List *onconflset;
770770
List *onconflcols;
771-
bool found_whole_row;
772771

773772
/*
774773
* Translate expressions in onConflictSet to account for

src/backend/executor/nodeWindowAgg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,12 +2062,13 @@ ExecWindowAgg(PlanState *pstate)
20622062
if (winstate->all_first)
20632063
{
20642064
int frameOptions = winstate->frameOptions;
2065-
ExprContext *econtext = winstate->ss.ps.ps_ExprContext;
20662065
Datum value;
20672066
bool isnull;
20682067
int16 len;
20692068
bool byval;
20702069

2070+
econtext = winstate->ss.ps.ps_ExprContext;
2071+
20712072
if (frameOptions & FRAMEOPTION_START_OFFSET)
20722073
{
20732074
Assert(winstate->startOffset != NULL);

src/backend/lib/integerset.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ intset_is_member(IntegerSet *intset, uint64 x)
565565
*/
566566
if (intset->num_buffered_values > 0 && x >= intset->buffered_values[0])
567567
{
568-
int itemno;
569-
570568
itemno = intset_binsrch_uint64(x,
571569
intset->buffered_values,
572570
intset->num_buffered_values,

src/backend/libpq/auth.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,8 +1652,6 @@ interpret_ident_response(const char *ident_response,
16521652
return false;
16531653
else
16541654
{
1655-
int i; /* Index into *ident_user */
1656-
16571655
cursor++; /* Go over colon */
16581656
while (pg_isblank(*cursor))
16591657
cursor++; /* skip blanks */

0 commit comments

Comments
 (0)