Commit a0d6e29e authored by Tom Lane's avatar Tom Lane

Some more de-FastList-ification.

parent 80c6847c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.161 2004/05/30 23:40:26 neilc Exp $ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.162 2004/06/01 03:28:41 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2826,12 +2826,11 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2826,12 +2826,11 @@ ExecInitExpr(Expr *node, PlanState *parent)
{ {
CaseExpr *caseexpr = (CaseExpr *) node; CaseExpr *caseexpr = (CaseExpr *) node;
CaseExprState *cstate = makeNode(CaseExprState); CaseExprState *cstate = makeNode(CaseExprState);
FastList outlist; List *outlist = NIL;
ListCell *l; ListCell *l;
cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCase; cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCase;
cstate->arg = ExecInitExpr(caseexpr->arg, parent); cstate->arg = ExecInitExpr(caseexpr->arg, parent);
FastListInit(&outlist);
foreach(l, caseexpr->args) foreach(l, caseexpr->args)
{ {
CaseWhen *when = (CaseWhen *) lfirst(l); CaseWhen *when = (CaseWhen *) lfirst(l);
...@@ -2842,9 +2841,9 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2842,9 +2841,9 @@ ExecInitExpr(Expr *node, PlanState *parent)
wstate->xprstate.expr = (Expr *) when; wstate->xprstate.expr = (Expr *) when;
wstate->expr = ExecInitExpr(when->expr, parent); wstate->expr = ExecInitExpr(when->expr, parent);
wstate->result = ExecInitExpr(when->result, parent); wstate->result = ExecInitExpr(when->result, parent);
FastAppend(&outlist, wstate); outlist = lappend(outlist, wstate);
} }
cstate->args = FastListValue(&outlist); cstate->args = outlist;
cstate->defresult = ExecInitExpr(caseexpr->defresult, parent); cstate->defresult = ExecInitExpr(caseexpr->defresult, parent);
state = (ExprState *) cstate; state = (ExprState *) cstate;
} }
...@@ -2853,20 +2852,19 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2853,20 +2852,19 @@ ExecInitExpr(Expr *node, PlanState *parent)
{ {
ArrayExpr *arrayexpr = (ArrayExpr *) node; ArrayExpr *arrayexpr = (ArrayExpr *) node;
ArrayExprState *astate = makeNode(ArrayExprState); ArrayExprState *astate = makeNode(ArrayExprState);
FastList outlist; List *outlist = NIL;
ListCell *l; ListCell *l;
astate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalArray; astate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalArray;
FastListInit(&outlist);
foreach(l, arrayexpr->elements) foreach(l, arrayexpr->elements)
{ {
Expr *e = (Expr *) lfirst(l); Expr *e = (Expr *) lfirst(l);
ExprState *estate; ExprState *estate;
estate = ExecInitExpr(e, parent); estate = ExecInitExpr(e, parent);
FastAppend(&outlist, estate); outlist = lappend(outlist, estate);
} }
astate->elements = FastListValue(&outlist); astate->elements = outlist;
/* do one-time catalog lookup for type info */ /* do one-time catalog lookup for type info */
get_typlenbyvalalign(arrayexpr->element_typeid, get_typlenbyvalalign(arrayexpr->element_typeid,
&astate->elemlength, &astate->elemlength,
...@@ -2879,11 +2877,10 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2879,11 +2877,10 @@ ExecInitExpr(Expr *node, PlanState *parent)
{ {
RowExpr *rowexpr = (RowExpr *) node; RowExpr *rowexpr = (RowExpr *) node;
RowExprState *rstate = makeNode(RowExprState); RowExprState *rstate = makeNode(RowExprState);
List *outlist; List *outlist = NIL;
ListCell *l; ListCell *l;
rstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalRow; rstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalRow;
outlist = NIL;
foreach(l, rowexpr->args) foreach(l, rowexpr->args)
{ {
Expr *e = (Expr *) lfirst(l); Expr *e = (Expr *) lfirst(l);
...@@ -2912,20 +2909,19 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2912,20 +2909,19 @@ ExecInitExpr(Expr *node, PlanState *parent)
{ {
CoalesceExpr *coalesceexpr = (CoalesceExpr *) node; CoalesceExpr *coalesceexpr = (CoalesceExpr *) node;
CoalesceExprState *cstate = makeNode(CoalesceExprState); CoalesceExprState *cstate = makeNode(CoalesceExprState);
FastList outlist; List *outlist = NIL;
ListCell *l; ListCell *l;
cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCoalesce; cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCoalesce;
FastListInit(&outlist);
foreach(l, coalesceexpr->args) foreach(l, coalesceexpr->args)
{ {
Expr *e = (Expr *) lfirst(l); Expr *e = (Expr *) lfirst(l);
ExprState *estate; ExprState *estate;
estate = ExecInitExpr(e, parent); estate = ExecInitExpr(e, parent);
FastAppend(&outlist, estate); outlist = lappend(outlist, estate);
} }
cstate->args = FastListValue(&outlist); cstate->args = outlist;
state = (ExprState *) cstate; state = (ExprState *) cstate;
} }
break; break;
...@@ -2984,18 +2980,17 @@ ExecInitExpr(Expr *node, PlanState *parent) ...@@ -2984,18 +2980,17 @@ ExecInitExpr(Expr *node, PlanState *parent)
break; break;
case T_List: case T_List:
{ {
FastList outlist; List *outlist = NIL;
ListCell *l; ListCell *l;
FastListInit(&outlist);
foreach(l, (List *) node) foreach(l, (List *) node)
{ {
FastAppend(&outlist, outlist = lappend(outlist,
ExecInitExpr((Expr *) lfirst(l), ExecInitExpr((Expr *) lfirst(l),
parent)); parent));
} }
/* Don't fall through to the "common" code below */ /* Don't fall through to the "common" code below */
return (ExprState *) FastListValue(&outlist); return (ExprState *) outlist;
} }
default: default:
elog(ERROR, "unrecognized node type: %d", elog(ERROR, "unrecognized node type: %d",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.458 2004/05/30 23:40:34 neilc Exp $ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.459 2004/06/01 03:28:48 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -108,7 +108,6 @@ static void doNegateFloat(Value *v); ...@@ -108,7 +108,6 @@ static void doNegateFloat(Value *v);
OnCommitAction oncommit; OnCommitAction oncommit;
ContainsOids withoids; ContainsOids withoids;
List *list; List *list;
FastList fastlist;
Node *node; Node *node;
Value *value; Value *value;
ColumnRef *columnref; ColumnRef *columnref;
...@@ -6820,15 +6819,11 @@ opt_indirection: ...@@ -6820,15 +6819,11 @@ opt_indirection:
expr_list: a_expr expr_list: a_expr
{ {
FastList *dst = (FastList *) &$$; $$ = list_make1($1);
makeFastList1(dst, $1);
} }
| expr_list ',' a_expr | expr_list ',' a_expr
{ {
FastList *dst = (FastList *) &$$; $$ = lappend($1, $3);
FastList *src = (FastList *) &$1;
*dst = *src;
FastAppend(dst, $3);
} }
; ;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.119 2004/05/30 23:40:35 neilc Exp $ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.120 2004/06/01 03:28:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -92,11 +92,9 @@ transformTargetEntry(ParseState *pstate, ...@@ -92,11 +92,9 @@ transformTargetEntry(ParseState *pstate,
List * List *
transformTargetList(ParseState *pstate, List *targetlist) transformTargetList(ParseState *pstate, List *targetlist)
{ {
FastList p_target; List *p_target = NIL;
ListCell *o_target; ListCell *o_target;
FastListInit(&p_target);
foreach(o_target, targetlist) foreach(o_target, targetlist)
{ {
ResTarget *res = (ResTarget *) lfirst(o_target); ResTarget *res = (ResTarget *) lfirst(o_target);
...@@ -116,8 +114,8 @@ transformTargetList(ParseState *pstate, List *targetlist) ...@@ -116,8 +114,8 @@ transformTargetList(ParseState *pstate, List *targetlist)
* Target item is a single '*', expand all tables * Target item is a single '*', expand all tables
* (e.g., SELECT * FROM emp) * (e.g., SELECT * FROM emp)
*/ */
FastConc(&p_target, p_target = list_concat(p_target,
ExpandAllTables(pstate)); ExpandAllTables(pstate));
} }
else else
{ {
...@@ -173,34 +171,34 @@ transformTargetList(ParseState *pstate, List *targetlist) ...@@ -173,34 +171,34 @@ transformTargetList(ParseState *pstate, List *targetlist)
rte = addImplicitRTE(pstate, makeRangeVar(schemaname, rte = addImplicitRTE(pstate, makeRangeVar(schemaname,
relname)); relname));
FastConc(&p_target, p_target = list_concat(p_target,
expandRelAttrs(pstate, rte)); expandRelAttrs(pstate, rte));
} }
} }
else else
{ {
/* Plain ColumnRef node, treat it as an expression */ /* Plain ColumnRef node, treat it as an expression */
FastAppend(&p_target, p_target = lappend(p_target,
transformTargetEntry(pstate, transformTargetEntry(pstate,
res->val, res->val,
NULL, NULL,
res->name, res->name,
false)); false));
} }
} }
else else
{ {
/* Everything else but ColumnRef */ /* Everything else but ColumnRef */
FastAppend(&p_target, p_target = lappend(p_target,
transformTargetEntry(pstate, transformTargetEntry(pstate,
res->val, res->val,
NULL, NULL,
res->name, res->name,
false)); false));
} }
} }
return FastListValue(&p_target); return p_target;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment