aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_func.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-02-28 14:25:01 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-02-28 14:25:01 -0500
commitc94fb8e8acc05c4b5f9f5b2a595ce7930827c2be (patch)
treeaafacc4fb6291f41aeb9eeb15234fbac83c83e90 /src/backend/parser/parse_func.c
parent0a271df705c98c1cc617078ebd069cf080fa5a16 (diff)
downloadpostgresql-c94fb8e8acc05c4b5f9f5b2a595ce7930827c2be.tar.gz
postgresql-c94fb8e8acc05c4b5f9f5b2a595ce7930827c2be.zip
Standardize some more loops that chase down parallel lists.
We have forboth() and forthree() macros that simplify iterating through several parallel lists, but not everyplace that could reasonably use those was doing so. Also invent forfour() and forfive() macros to do the same for four or five parallel lists, and use those where applicable. The immediate motivation for doing this is to reduce the number of ad-hoc lnext() calls, to reduce the footprint of a WIP patch. However, it seems like good cleanup and error-proofing anyway; the places that were combining forthree() with a manually iterated loop seem particularly illegible and bug-prone. There was some speculation about restructuring related parsetree representations to reduce the need for parallel list chasing of this sort. Perhaps that's a win, or perhaps not, but in any case it would be considerably more invasive than this patch; and it's not particularly related to my immediate goal of improving the List infrastructure. So I'll leave that question for another day. Patch by me; thanks to David Rowley for review. Discussion: https://postgr.es/m/11587.1550975080@sss.pgh.pa.us
Diffstat (limited to 'src/backend/parser/parse_func.c')
-rw-r--r--src/backend/parser/parse_func.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 5222231b511..654ee80b279 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -2124,13 +2124,12 @@ LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, bool noError)
FUNC_MAX_ARGS,
FUNC_MAX_ARGS)));
- args_item = list_head(func->objargs);
- for (i = 0; i < argcount; i++)
+ i = 0;
+ foreach(args_item, func->objargs)
{
TypeName *t = (TypeName *) lfirst(args_item);
- argoids[i] = LookupTypeNameOid(NULL, t, noError);
- args_item = lnext(args_item);
+ argoids[i++] = LookupTypeNameOid(NULL, t, noError);
}
/*