aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-09-27 04:12:03 +0000
committerNeil Conway <neilc@samurai.com>2004-09-27 04:12:03 +0000
commit64a60590ba5da8026abb65a7abe8fce9e573c476 (patch)
treefbb640591745e267977b99289e25e6ef4694fb08 /src/backend/parser/analyze.c
parent0ed07d49d5b5aed54da02b9dfa87856ba09af859 (diff)
downloadpostgresql-64a60590ba5da8026abb65a7abe8fce9e573c476.tar.gz
postgresql-64a60590ba5da8026abb65a7abe8fce9e573c476.zip
A few minor list-related cleanups:
(1) Replace while loop with the new forboth() construct in parser/analyze.c (2) Replace lcons() with lappend() in SearchCatCacheList(). Since these now have the same performance, there is no reason to prefer lcons() in this case, and using lappend() leads to cleaner code. (3) Improve the name of the second parameter to for_each_cell()
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index d05be5de5d3..c3b547dd5b7 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.311 2004/08/29 05:06:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.312 2004/09/27 04:12:02 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2273,25 +2273,21 @@ getSetColTypes(ParseState *pstate, Node *node)
static void
applyColumnNames(List *dst, List *src)
{
- ListCell *dst_item = list_head(dst);
- ListCell *src_item = list_head(src);
+ ListCell *dst_item;
+ ListCell *src_item;
if (list_length(src) > list_length(dst))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("CREATE TABLE AS specifies too many column names")));
- while (src_item != NULL && dst_item != NULL)
+ forboth(dst_item, dst, src_item, src)
{
TargetEntry *d = (TargetEntry *) lfirst(dst_item);
ColumnDef *s = (ColumnDef *) lfirst(src_item);
Assert(d->resdom && !d->resdom->resjunk);
-
d->resdom->resname = pstrdup(s->colname);
-
- dst_item = lnext(dst_item);
- src_item = lnext(src_item);
}
}