1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Rename shadowed local variables

In a similar effort to f01592f91, here we mostly rename shadowed local
variables to remove the warnings produced when compiling with
-Wshadow=compatible-local.

This fixes 63 warnings and leaves just 5.

Author: Justin Pryzby, David Rowley
Reviewed-by: Justin Pryzby
Discussion https://postgr.es/m/20220817145434.GC26426%40telsasoft.com
This commit is contained in:
David Rowley
2022-10-05 21:01:41 +13:00
parent 839c2520a7
commit 2d0bbedda7
39 changed files with 220 additions and 226 deletions

View File

@@ -2217,13 +2217,13 @@ cost_append(AppendPath *apath)
if (pathkeys == NIL)
{
Path *subpath = (Path *) linitial(apath->subpaths);
Path *firstsubpath = (Path *) linitial(apath->subpaths);
/*
* For an unordered, non-parallel-aware Append we take the startup
* cost as the startup cost of the first subpath.
*/
apath->path.startup_cost = subpath->startup_cost;
apath->path.startup_cost = firstsubpath->startup_cost;
/* Compute rows and costs as sums of subplan rows and costs. */
foreach(l, apath->subpaths)

View File

@@ -1303,11 +1303,11 @@ generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
}
else
{
RestrictInfo *rinfo = castNode(RestrictInfo, orarg);
RestrictInfo *ri = castNode(RestrictInfo, orarg);
List *orargs;
Assert(!restriction_is_or_clause(rinfo));
orargs = list_make1(rinfo);
Assert(!restriction_is_or_clause(ri));
orargs = list_make1(ri);
indlist = build_paths_for_OR(root, rel,
orargs,

View File

@@ -305,10 +305,10 @@ TidQualFromRestrictInfoList(PlannerInfo *root, List *rlist, RelOptInfo *rel)
}
else
{
RestrictInfo *rinfo = castNode(RestrictInfo, orarg);
RestrictInfo *ri = castNode(RestrictInfo, orarg);
Assert(!restriction_is_or_clause(rinfo));
sublist = TidQualFromRestrictInfo(root, rinfo, rel);
Assert(!restriction_is_or_clause(ri));
sublist = TidQualFromRestrictInfo(root, ri, rel);
}
/*

View File

@@ -3449,7 +3449,6 @@ get_number_of_groups(PlannerInfo *root,
{
/* Add up the estimates for each grouping set */
ListCell *lc;
ListCell *lc2;
Assert(gd); /* keep Coverity happy */
@@ -3458,17 +3457,18 @@ get_number_of_groups(PlannerInfo *root,
foreach(lc, gd->rollups)
{
RollupData *rollup = lfirst_node(RollupData, lc);
ListCell *lc;
ListCell *lc2;
ListCell *lc3;
groupExprs = get_sortgrouplist_exprs(rollup->groupClause,
target_list);
rollup->numGroups = 0.0;
forboth(lc, rollup->gsets, lc2, rollup->gsets_data)
forboth(lc2, rollup->gsets, lc3, rollup->gsets_data)
{
List *gset = (List *) lfirst(lc);
GroupingSetData *gs = lfirst_node(GroupingSetData, lc2);
List *gset = (List *) lfirst(lc2);
GroupingSetData *gs = lfirst_node(GroupingSetData, lc3);
double numGroups = estimate_num_groups(root,
groupExprs,
path_rows,
@@ -3484,6 +3484,8 @@ get_number_of_groups(PlannerInfo *root,
if (gd->hash_sets_idx)
{
ListCell *lc2;
gd->dNumHashGroups = 0;
groupExprs = get_sortgrouplist_exprs(parse->groupClause,

View File

@@ -658,9 +658,10 @@ generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
/* Find the highest number of workers requested for any subpath. */
foreach(lc, partial_pathlist)
{
Path *path = lfirst(lc);
Path *subpath = lfirst(lc);
parallel_workers = Max(parallel_workers, path->parallel_workers);
parallel_workers = Max(parallel_workers,
subpath->parallel_workers);
}
Assert(parallel_workers > 0);

View File

@@ -4463,16 +4463,16 @@ inline_function(Oid funcid, Oid result_type, Oid result_collid,
if (!isNull)
{
Node *n;
List *querytree_list;
List *query_list;
n = stringToNode(TextDatumGetCString(tmp));
if (IsA(n, List))
querytree_list = linitial_node(List, castNode(List, n));
query_list = linitial_node(List, castNode(List, n));
else
querytree_list = list_make1(n);
if (list_length(querytree_list) != 1)
query_list = list_make1(n);
if (list_length(query_list) != 1)
goto fail;
querytree = linitial(querytree_list);
querytree = linitial(query_list);
/*
* Because we'll insist below that the querytree have an empty rtable

View File

@@ -437,16 +437,16 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
{
Var *var = (Var *) pitem->item;
NestLoopParam *nlp;
ListCell *lc;
ListCell *lc2;
/* If not from a nestloop outer rel, complain */
if (!bms_is_member(var->varno, root->curOuterRels))
elog(ERROR, "non-LATERAL parameter required by subquery");
/* Is this param already listed in root->curOuterParams? */
foreach(lc, root->curOuterParams)
foreach(lc2, root->curOuterParams)
{
nlp = (NestLoopParam *) lfirst(lc);
nlp = (NestLoopParam *) lfirst(lc2);
if (nlp->paramno == pitem->paramId)
{
Assert(equal(var, nlp->paramval));
@@ -454,7 +454,7 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
break;
}
}
if (lc == NULL)
if (lc2 == NULL)
{
/* No, so add it */
nlp = makeNode(NestLoopParam);
@@ -467,7 +467,7 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
{
PlaceHolderVar *phv = (PlaceHolderVar *) pitem->item;
NestLoopParam *nlp;
ListCell *lc;
ListCell *lc2;
/* If not from a nestloop outer rel, complain */
if (!bms_is_subset(find_placeholder_info(root, phv)->ph_eval_at,
@@ -475,9 +475,9 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
elog(ERROR, "non-LATERAL parameter required by subquery");
/* Is this param already listed in root->curOuterParams? */
foreach(lc, root->curOuterParams)
foreach(lc2, root->curOuterParams)
{
nlp = (NestLoopParam *) lfirst(lc);
nlp = (NestLoopParam *) lfirst(lc2);
if (nlp->paramno == pitem->paramId)
{
Assert(equal(phv, nlp->paramval));
@@ -485,7 +485,7 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
break;
}
}
if (lc == NULL)
if (lc2 == NULL)
{
/* No, so add it */
nlp = makeNode(NestLoopParam);