More -Wshadow=compatible-local warning fixes
In a similar effort to f01592f91
, 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
This commit is contained in:
parent
e3ce2de09d
commit
3e0fff2e68
|
@ -240,7 +240,6 @@ hash_xlog_add_ovfl_page(XLogReaderState *record)
|
|||
{
|
||||
Page mappage = (Page) BufferGetPage(mapbuffer);
|
||||
uint32 *freep = NULL;
|
||||
char *data;
|
||||
uint32 *bitmap_page_bit;
|
||||
|
||||
freep = HashPageGetBitmap(mappage);
|
||||
|
|
|
@ -1614,7 +1614,6 @@ mXactCachePut(MultiXactId multi, int nmembers, MultiXactMember *members)
|
|||
if (MXactCacheMembers++ >= MAX_CACHE_ENTRIES)
|
||||
{
|
||||
dlist_node *node;
|
||||
mXactCacheEnt *entry;
|
||||
|
||||
node = dlist_tail_node(&MXactCache);
|
||||
dlist_delete(node);
|
||||
|
|
|
@ -3036,8 +3036,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
|
|||
pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_SYNC);
|
||||
if (pg_fsync(fd) != 0)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
save_errno = errno;
|
||||
close(fd);
|
||||
errno = save_errno;
|
||||
ereport(ERROR,
|
||||
|
@ -4721,7 +4720,6 @@ XLogInitNewTimeline(TimeLineID endTLI, XLogRecPtr endOfLog, TimeLineID newTLI)
|
|||
|
||||
if (close(fd) != 0)
|
||||
{
|
||||
char xlogfname[MAXFNAMELEN];
|
||||
int save_errno = errno;
|
||||
|
||||
XLogFileName(xlogfname, newTLI, startLogSegNo, wal_segment_size);
|
||||
|
|
|
@ -121,7 +121,6 @@ compute_return_type(TypeName *returnType, Oid languageOid,
|
|||
{
|
||||
char *typnam = TypeNameToString(returnType);
|
||||
Oid namespaceId;
|
||||
AclResult aclresult;
|
||||
char *typname;
|
||||
ObjectAddress address;
|
||||
|
||||
|
@ -1112,8 +1111,6 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
|
|||
if (languageStruct->lanpltrusted)
|
||||
{
|
||||
/* if trusted language, need USAGE privilege */
|
||||
AclResult aclresult;
|
||||
|
||||
aclresult = pg_language_aclcheck(languageOid, GetUserId(), ACL_USAGE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, OBJECT_LANGUAGE,
|
||||
|
|
|
@ -16796,7 +16796,6 @@ PreCommit_on_commit_actions(void)
|
|||
if (oids_to_drop != NIL)
|
||||
{
|
||||
ObjectAddresses *targetObjects = new_object_addresses();
|
||||
ListCell *l;
|
||||
|
||||
foreach(l, oids_to_drop)
|
||||
{
|
||||
|
|
|
@ -233,8 +233,6 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
|
|||
*/
|
||||
if (!(params.options & VACOPT_ANALYZE))
|
||||
{
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, vacstmt->rels)
|
||||
{
|
||||
VacuumRelation *vrel = lfirst_node(VacuumRelation, lc);
|
||||
|
|
|
@ -768,7 +768,6 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
|
|||
{
|
||||
List *onconflset;
|
||||
List *onconflcols;
|
||||
bool found_whole_row;
|
||||
|
||||
/*
|
||||
* Translate expressions in onConflictSet to account for
|
||||
|
|
|
@ -2062,12 +2062,13 @@ ExecWindowAgg(PlanState *pstate)
|
|||
if (winstate->all_first)
|
||||
{
|
||||
int frameOptions = winstate->frameOptions;
|
||||
ExprContext *econtext = winstate->ss.ps.ps_ExprContext;
|
||||
Datum value;
|
||||
bool isnull;
|
||||
int16 len;
|
||||
bool byval;
|
||||
|
||||
econtext = winstate->ss.ps.ps_ExprContext;
|
||||
|
||||
if (frameOptions & FRAMEOPTION_START_OFFSET)
|
||||
{
|
||||
Assert(winstate->startOffset != NULL);
|
||||
|
|
|
@ -565,8 +565,6 @@ intset_is_member(IntegerSet *intset, uint64 x)
|
|||
*/
|
||||
if (intset->num_buffered_values > 0 && x >= intset->buffered_values[0])
|
||||
{
|
||||
int itemno;
|
||||
|
||||
itemno = intset_binsrch_uint64(x,
|
||||
intset->buffered_values,
|
||||
intset->num_buffered_values,
|
||||
|
|
|
@ -1652,8 +1652,6 @@ interpret_ident_response(const char *ident_response,
|
|||
return false;
|
||||
else
|
||||
{
|
||||
int i; /* Index into *ident_user */
|
||||
|
||||
cursor++; /* Go over colon */
|
||||
while (pg_isblank(*cursor))
|
||||
cursor++; /* skip blanks */
|
||||
|
|
|
@ -361,7 +361,6 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
|
|||
if (bitjoinpaths != NIL)
|
||||
{
|
||||
List *all_path_outers;
|
||||
ListCell *lc;
|
||||
|
||||
/* Identify each distinct parameterization seen in bitjoinpaths */
|
||||
all_path_outers = NIL;
|
||||
|
@ -2188,7 +2187,7 @@ match_clause_to_index(PlannerInfo *root,
|
|||
/* Ignore duplicates */
|
||||
foreach(lc, clauseset->indexclauses[indexcol])
|
||||
{
|
||||
IndexClause *iclause = (IndexClause *) lfirst(lc);
|
||||
iclause = (IndexClause *) lfirst(lc);
|
||||
|
||||
if (iclause->rinfo == rinfo)
|
||||
return;
|
||||
|
|
|
@ -3484,8 +3484,6 @@ get_number_of_groups(PlannerInfo *root,
|
|||
|
||||
if (gd->hash_sets_idx)
|
||||
{
|
||||
ListCell *lc;
|
||||
|
||||
gd->dNumHashGroups = 0;
|
||||
|
||||
groupExprs = get_sortgrouplist_exprs(parse->groupClause,
|
||||
|
@ -4720,8 +4718,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
Path *cheapest_input_path = input_rel->cheapest_total_path;
|
||||
double numDistinctRows;
|
||||
bool allow_hash;
|
||||
Path *path;
|
||||
ListCell *lc;
|
||||
|
||||
/* Estimate number of distinct rows there will be */
|
||||
if (parse->groupClause || parse->groupingSets || parse->hasAggs ||
|
||||
|
@ -4766,6 +4762,8 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
* the other.)
|
||||
*/
|
||||
List *needed_pathkeys;
|
||||
Path *path;
|
||||
ListCell *lc;
|
||||
|
||||
if (parse->hasDistinctOn &&
|
||||
list_length(root->distinct_pathkeys) <
|
||||
|
@ -4776,7 +4774,7 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
|||
|
||||
foreach(lc, input_rel->pathlist)
|
||||
{
|
||||
Path *path = (Path *) lfirst(lc);
|
||||
path = (Path *) lfirst(lc);
|
||||
|
||||
if (pathkeys_contained_in(needed_pathkeys, path->pathkeys))
|
||||
{
|
||||
|
@ -5034,8 +5032,6 @@ create_ordered_paths(PlannerInfo *root,
|
|||
*/
|
||||
if (enable_incremental_sort && list_length(root->sort_pathkeys) > 1)
|
||||
{
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, input_rel->partial_pathlist)
|
||||
{
|
||||
Path *input_path = (Path *) lfirst(lc);
|
||||
|
@ -7607,7 +7603,6 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
|
|||
AppendRelInfo **appinfos;
|
||||
int nappinfos;
|
||||
List *child_scanjoin_targets = NIL;
|
||||
ListCell *lc;
|
||||
|
||||
Assert(child_rel != NULL);
|
||||
|
||||
|
|
|
@ -2554,8 +2554,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
|||
|
||||
case T_Append:
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
foreach(l, ((Append *) plan)->appendplans)
|
||||
{
|
||||
context.paramids =
|
||||
|
@ -2571,8 +2569,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
|||
|
||||
case T_MergeAppend:
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
foreach(l, ((MergeAppend *) plan)->mergeplans)
|
||||
{
|
||||
context.paramids =
|
||||
|
@ -2588,8 +2584,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
|||
|
||||
case T_BitmapAnd:
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
foreach(l, ((BitmapAnd *) plan)->bitmapplans)
|
||||
{
|
||||
context.paramids =
|
||||
|
@ -2605,8 +2599,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
|||
|
||||
case T_BitmapOr:
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
foreach(l, ((BitmapOr *) plan)->bitmapplans)
|
||||
{
|
||||
context.paramids =
|
||||
|
@ -2622,8 +2614,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
|||
|
||||
case T_NestLoop:
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
finalize_primnode((Node *) ((Join *) plan)->joinqual,
|
||||
&context);
|
||||
/* collect set of params that will be passed to right child */
|
||||
|
|
|
@ -653,7 +653,6 @@ generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
|
|||
if (partial_paths_valid)
|
||||
{
|
||||
Path *ppath;
|
||||
ListCell *lc;
|
||||
int parallel_workers = 0;
|
||||
|
||||
/* Find the highest number of workers requested for any subpath. */
|
||||
|
|
|
@ -1102,7 +1102,7 @@ rebuild_database_list(Oid newdb)
|
|||
*/
|
||||
for (i = 0; i < nelems; i++)
|
||||
{
|
||||
avl_dbase *db = &(dbary[i]);
|
||||
db = &(dbary[i]);
|
||||
|
||||
current_time = TimestampTzPlusMilliseconds(current_time,
|
||||
millis_increment);
|
||||
|
|
|
@ -824,7 +824,6 @@ add_with_check_options(Relation rel,
|
|||
{
|
||||
RowSecurityPolicy *policy = (RowSecurityPolicy *) lfirst(item);
|
||||
Expr *qual = QUAL_FOR_WCO(policy);
|
||||
WithCheckOption *wco;
|
||||
|
||||
if (qual != NULL)
|
||||
{
|
||||
|
|
|
@ -1265,7 +1265,6 @@ dependency_is_compatible_expression(Node *clause, Index relid, List *statlist, N
|
|||
else if (is_orclause(clause))
|
||||
{
|
||||
BoolExpr *bool_expr = (BoolExpr *) clause;
|
||||
ListCell *lc;
|
||||
|
||||
/* start with no expression (we'll use the first match) */
|
||||
*expr = NULL;
|
||||
|
|
|
@ -693,7 +693,6 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
|
|||
* quadrants if we're looking for a value strictly greater
|
||||
* than the maximum.
|
||||
*/
|
||||
int cmp;
|
||||
|
||||
cmp = range_cmp_bounds(typcache, ¢roidLower, maxLower);
|
||||
if (cmp > 0 || (!inclusive && cmp == 0))
|
||||
|
@ -721,7 +720,6 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
|
|||
* quadrants if we're looking for a value strictly greater
|
||||
* than the maximum.
|
||||
*/
|
||||
int cmp;
|
||||
|
||||
cmp = range_cmp_bounds(typcache, ¢roidUpper, maxUpper);
|
||||
if (cmp > 0 || (!inclusive && cmp == 0))
|
||||
|
|
|
@ -1303,7 +1303,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
|
|||
if (!heap_attisnull(ht_idx, Anum_pg_index_indexprs, NULL))
|
||||
{
|
||||
Datum exprsDatum;
|
||||
bool isnull;
|
||||
char *exprsString;
|
||||
|
||||
exprsDatum = SysCacheGetAttr(INDEXRELID, ht_idx,
|
||||
|
@ -1500,7 +1499,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
|
|||
{
|
||||
Node *node;
|
||||
Datum predDatum;
|
||||
bool isnull;
|
||||
char *predString;
|
||||
|
||||
/* Convert text string to node tree */
|
||||
|
@ -1945,7 +1943,6 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
|
|||
if (!heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs, NULL))
|
||||
{
|
||||
Datum exprsDatum;
|
||||
bool isnull;
|
||||
char *exprsString;
|
||||
|
||||
exprsDatum = SysCacheGetAttr(PARTRELID, tuple,
|
||||
|
|
|
@ -3109,7 +3109,6 @@ sendCommand(CState *st, Command *command)
|
|||
for (j = 0; commands[j] != NULL; j++)
|
||||
{
|
||||
PGresult *res;
|
||||
char name[MAX_PREPARE_NAME];
|
||||
|
||||
if (commands[j]->type != SQL_COMMAND)
|
||||
continue;
|
||||
|
@ -3803,8 +3802,6 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
|
|||
/* quickly skip commands until something to do... */
|
||||
while (true)
|
||||
{
|
||||
Command *command;
|
||||
|
||||
command = sql_script[st->use_file].commands[st->command];
|
||||
|
||||
/* cannot reach end of script in that state */
|
||||
|
@ -3959,8 +3956,6 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
|
|||
*/
|
||||
if (report_per_command)
|
||||
{
|
||||
Command *command;
|
||||
|
||||
pg_time_now_lazy(&now);
|
||||
|
||||
command = sql_script[st->use_file].commands[st->command];
|
||||
|
|
Loading…
Reference in New Issue