From 5088f0748a39c3f480d9a9c1b34c2a25d3011611 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 17 Jan 2001 17:26:45 +0000
Subject: [PATCH] Change lcons(x, NIL) to makeList(x) where appropriate.

---
 src/backend/bootstrap/bootparse.y            |  4 ++--
 src/backend/commands/user.c                  |  7 ++++---
 src/backend/executor/execJunk.c              |  4 ++--
 src/backend/nodes/copyfuncs.c                | 10 +++++-----
 src/backend/nodes/list.c                     |  6 +++---
 src/backend/nodes/makefuncs.c                |  4 ++--
 src/backend/optimizer/geqo/geqo_eval.c       |  4 ++--
 src/backend/optimizer/path/_deadcode/xfunc.c |  4 ++--
 src/backend/optimizer/path/pathkeys.c        | 10 +++++-----
 src/backend/optimizer/prep/prepunion.c       |  4 ++--
 src/backend/parser/gram.y                    |  8 ++++----
 src/backend/parser/parse_coerce.c            |  6 +++---
 12 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index d0b0c0c5a8..68e122373e 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.33 2000/11/21 21:15:59 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.34 2001/01/17 17:26:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -254,7 +254,7 @@ Boot_BuildIndsStmt:
 
 boot_index_params:
 		boot_index_params COMMA boot_index_param	{ $$ = lappend($1, $3); }
-		| boot_index_param							{ $$ = lcons($1, NIL); }
+		| boot_index_param							{ $$ = makeList1($1); }
 		;
 
 boot_index_param:
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index a33098b2e0..27f1d3c2e1 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.70 2000/11/16 22:30:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.71 2001/01/17 17:26:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -311,7 +311,8 @@ CreateUser(CreateUserStmt *stmt)
 		ags.name = strVal(lfirst(item));		/* the group name to add
 												 * this in */
 		ags.action = +1;
-		ags.listUsers = lcons((void *) makeInteger(havesysid ? stmt->sysid : max_id + 1), NIL);
+		ags.listUsers = makeList1(makeInteger(havesysid ?
+							stmt->sysid : max_id + 1));
 		AlterGroup(&ags, "CREATE USER");
 	}
 
@@ -600,7 +601,7 @@ DropUser(DropUserStmt *stmt)
 			datum = heap_getattr(tmp_tuple, Anum_pg_group_groname, pg_dsc, &null);
 			ags.name = DatumGetCString(DirectFunctionCall1(nameout, datum));
 			ags.action = -1;
-			ags.listUsers = lcons((void *) makeInteger(usesysid), NIL);
+			ags.listUsers = makeList1(makeInteger(usesysid));
 			AlterGroup(&ags, "DROP USER");
 		}
 		heap_endscan(scan);
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c
index f035f0c09d..d45497d154 100644
--- a/src/backend/executor/execJunk.c
+++ b/src/backend/executor/execJunk.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.22 2000/01/26 05:56:21 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.23 2001/01/17 17:26:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType)
 			Fjoin	   *fjNode = (Fjoin *) tl_node(fjList);
 
 			cleanFjoin = (Fjoin) copyObject((Node) fjNode);
-			cleanFjList = lcons(cleanFjoin, NIL);
+			cleanFjList = makeList1(cleanFjoin);
 
 			resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
 			expr = lsecond(get_fj_innerNode(fjNode));
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 89574db471..025d11e960 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.136 2001/01/05 06:34:17 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.137 2001/01/17 17:26:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,11 +58,11 @@ listCopy(List *list)
 	if (list == NIL)
 		return NIL;
 
-	newlist = nl = lcons(lfirst(list), NIL);
+	newlist = nl = makeList1(lfirst(list));
 
 	foreach(l, lnext(list))
 	{
-		lnext(nl) = lcons(lfirst(l), NIL);
+		lnext(nl) = makeList1(lfirst(l));
 		nl = lnext(nl);
 	}
 	return newlist;
@@ -2745,12 +2745,12 @@ copyObject(void *from)
 
 				/* rather ugly coding for speed... */
 				/* Note the input list cannot be NIL if we got here. */
-				nl = lcons(copyObject(lfirst(list)), NIL);
+				nl = makeList1(copyObject(lfirst(list)));
 				retval = nl;
 
 				foreach(l, lnext(list))
 				{
-					lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
+					lnext(nl) = makeList1(copyObject(lfirst(l)));
 					nl = lnext(nl);
 				}
 			}
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index c106a13112..a3668ed0dc 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.36 2000/10/31 10:22:10 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.37 2001/01/17 17:26:44 momjian Exp $
  *
  * NOTES
  *	  XXX a few of the following functions are duplicated to handle
@@ -127,7 +127,7 @@ lconsi(int datum, List *list)
 List *
 lappend(List *list, void *obj)
 {
-	return nconc(list, lcons(obj, NIL));
+	return nconc(list, makeList1(obj));
 }
 
 /*
@@ -138,7 +138,7 @@ lappend(List *list, void *obj)
 List *
 lappendi(List *list, int datum)
 {
-	return nconc(list, lconsi(datum, NIL));
+	return nconc(list, makeListi1(datum));
 }
 
 /*
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index 95bf730963..05376a3510 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.23 2000/11/16 22:30:23 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.24 2001/01/17 17:26:44 momjian Exp $
  *
  * NOTES
  *	  Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -178,7 +178,7 @@ makeAttr(char *relname, char *attname)
 	a->relname = pstrdup(relname);
 	a->paramNo = NULL;
 	if (attname != NULL)
-		a->attrs = lcons(makeString(pstrdup(attname)), NIL);
+		a->attrs = makeList1(makeString(pstrdup(attname)));
 	a->indirection = NULL;
 
 	return a;
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index 1970ca9a43..bd6fa801a4 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_eval.c,v 1.55 2000/09/19 18:42:33 tgl Exp $
+ * $Id: geqo_eval.c,v 1.56 2001/01/17 17:26:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -122,7 +122,7 @@ gimme_tree(Query *root, List *initial_rels,
 		else
 		{
 			/* tree main part */
-			List	   *acceptable_rels = lcons(inner_rel, NIL);
+			List	   *acceptable_rels = makeList1(inner_rel);
 			List	   *new_rels;
 			RelOptInfo *new_rel;
 
diff --git a/src/backend/optimizer/path/_deadcode/xfunc.c b/src/backend/optimizer/path/_deadcode/xfunc.c
index fecd4444ae..2de9d39b9c 100644
--- a/src/backend/optimizer/path/_deadcode/xfunc.c
+++ b/src/backend/optimizer/path/_deadcode/xfunc.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.13 2000/01/26 05:56:36 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/xfunc.c,v 1.14 2001/01/17 17:26:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -300,7 +300,7 @@ xfunc_pullup(Query *queryInfo,
 										get_clause(cinfo), LispNil);
 	xfunc_copyrel(get_parent(newkid), &newrel);
 	set_parent(newkid, newrel);
-	set_pathlist(newrel, lcons(newkid, NIL));
+	set_pathlist(newrel, makeList1(newkid));
 	set_unorderedpath(newrel, (PathPtr) newkid);
 	set_cheapestpath(newrel, (PathPtr) newkid);
 	set_size(newrel,
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index 9c4e537d55..2b1bf60d07 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.28 2000/12/14 22:30:43 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.29 2001/01/17 17:26:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -119,7 +119,7 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
 
 			/* Build the new set only when we know we must */
 			if (newset == NIL)
-				newset = lcons(item1, lcons(item2, NIL));
+				newset = makeList2(item1, item2);
 
 			/* Found a set to merge into our new set */
 			newset = set_union(newset, curset);
@@ -135,7 +135,7 @@ add_equijoined_keys(Query *root, RestrictInfo *restrictinfo)
 
 	/* Build the new set only when we know we must */
 	if (newset == NIL)
-		newset = lcons(item1, lcons(item2, NIL));
+		newset = makeList2(item1, item2);
 
 	root->equi_key_list = lcons(newset, root->equi_key_list);
 }
@@ -534,7 +534,7 @@ build_index_pathkeys(Query *root,
 		/* Make a one-sublist pathkeys list for the function expression */
 		item = makePathKeyItem((Node *) make_funcclause(funcnode, funcargs),
 							   sortop);
-		retval = lcons(make_canonical_pathkey(root, item), NIL);
+		retval = makeList1(make_canonical_pathkey(root, item));
 	}
 	else
 	{
@@ -678,7 +678,7 @@ make_pathkeys_for_sortclauses(List *sortclauses,
 		 * canonicalize_pathkeys() might replace it with a longer sublist
 		 * later.
 		 */
-		pathkeys = lappend(pathkeys, lcons(pathkey, NIL));
+		pathkeys = lappend(pathkeys, makeList1(pathkey));
 	}
 	return pathkeys;
 }
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 5da3c1e738..3ba756f6a8 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.58 2000/12/14 22:30:44 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.59 2001/01/17 17:26:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -467,7 +467,7 @@ List *
 find_all_inheritors(Oid parentrel)
 {
 	List	   *examined_relids = NIL;
-	List	   *unexamined_relids = lconsi(parentrel, NIL);
+	List	   *unexamined_relids = makeListi1(parentrel);
 
 	/*
 	 * While the queue of unexamined relids is nonempty, remove the first
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 8da450499e..c608a927d1 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.215 2001/01/15 20:36:36 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.216 2001/01/17 17:26:45 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -2918,7 +2918,7 @@ createdb_opt_item:  LOCATION '=' Sconst
 				}
 		| LOCATION '=' DEFAULT
 				{
-					$$ = lconsi(1, makeList1((char *) NULL));
+					$$ = lconsi(1, makeList1(NULL));
 				}
 		| TEMPLATE '=' name
 				{
@@ -2926,7 +2926,7 @@ createdb_opt_item:  LOCATION '=' Sconst
 				}
 		| TEMPLATE '=' DEFAULT
 				{
-					$$ = lconsi(2, makeList1((char *) NULL));
+					$$ = lconsi(2, makeList1(NULL));
 				}
 		| ENCODING '=' Sconst
 				{
@@ -3383,7 +3383,7 @@ simple_select: SELECT opt_distinct target_list
 
 		/* easy way to return two values. Can someone improve this?  bjm */
 into_clause:  INTO OptTempTableName		{ $$ = $2; }
-		| /*EMPTY*/						{ $$ = lcons(makeInteger(FALSE), NIL); }
+		| /*EMPTY*/						{ $$ = makeList1(makeInteger(FALSE)); }
 		;
 
 /*
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 97b3d23940..de004ee52c 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.52 2000/12/17 04:32:29 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.53 2001/01/17 17:26:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -128,7 +128,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
 		FuncCall   *n = makeNode(FuncCall);
 
 		n->funcname = typeidTypeName(targetTypeId);
-		n->args = lcons(node, NIL);
+		n->args = makeList1(node);
 		n->agg_star = false;
 		n->agg_distinct = false;
 
@@ -304,7 +304,7 @@ coerce_type_typmod(ParseState *pstate, Node *node,
 		cons->val.val.ival = atttypmod;
 
 		func->funcname = funcname;
-		func->args = lappend(lcons(node, NIL), cons);
+		func->args = makeList2(node, cons);
 		func->agg_star = false;
 		func->agg_distinct = false;
 
-- 
2.24.1