From a0d6e29ee703959449e6cc8b62a759e302d26039 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 1 Jun 2004 03:28:48 +0000 Subject: [PATCH] Some more de-FastList-ification. --- src/backend/executor/execQual.c | 37 +++++++++++++--------------- src/backend/parser/gram.y | 11 +++------ src/backend/parser/parse_target.c | 40 +++++++++++++++---------------- 3 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index d3ec919bcc..e53820efed 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -8,7 +8,7 @@ * * * 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) { CaseExpr *caseexpr = (CaseExpr *) node; CaseExprState *cstate = makeNode(CaseExprState); - FastList outlist; + List *outlist = NIL; ListCell *l; cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCase; cstate->arg = ExecInitExpr(caseexpr->arg, parent); - FastListInit(&outlist); foreach(l, caseexpr->args) { CaseWhen *when = (CaseWhen *) lfirst(l); @@ -2842,9 +2841,9 @@ ExecInitExpr(Expr *node, PlanState *parent) wstate->xprstate.expr = (Expr *) when; wstate->expr = ExecInitExpr(when->expr, 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); state = (ExprState *) cstate; } @@ -2853,20 +2852,19 @@ ExecInitExpr(Expr *node, PlanState *parent) { ArrayExpr *arrayexpr = (ArrayExpr *) node; ArrayExprState *astate = makeNode(ArrayExprState); - FastList outlist; + List *outlist = NIL; ListCell *l; astate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalArray; - FastListInit(&outlist); foreach(l, arrayexpr->elements) { Expr *e = (Expr *) lfirst(l); ExprState *estate; 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 */ get_typlenbyvalalign(arrayexpr->element_typeid, &astate->elemlength, @@ -2879,11 +2877,10 @@ ExecInitExpr(Expr *node, PlanState *parent) { RowExpr *rowexpr = (RowExpr *) node; RowExprState *rstate = makeNode(RowExprState); - List *outlist; + List *outlist = NIL; ListCell *l; rstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalRow; - outlist = NIL; foreach(l, rowexpr->args) { Expr *e = (Expr *) lfirst(l); @@ -2912,20 +2909,19 @@ ExecInitExpr(Expr *node, PlanState *parent) { CoalesceExpr *coalesceexpr = (CoalesceExpr *) node; CoalesceExprState *cstate = makeNode(CoalesceExprState); - FastList outlist; + List *outlist = NIL; ListCell *l; cstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCoalesce; - FastListInit(&outlist); foreach(l, coalesceexpr->args) { Expr *e = (Expr *) lfirst(l); ExprState *estate; estate = ExecInitExpr(e, parent); - FastAppend(&outlist, estate); + outlist = lappend(outlist, estate); } - cstate->args = FastListValue(&outlist); + cstate->args = outlist; state = (ExprState *) cstate; } break; @@ -2984,18 +2980,17 @@ ExecInitExpr(Expr *node, PlanState *parent) break; case T_List: { - FastList outlist; + List *outlist = NIL; ListCell *l; - FastListInit(&outlist); foreach(l, (List *) node) { - FastAppend(&outlist, - ExecInitExpr((Expr *) lfirst(l), - parent)); + outlist = lappend(outlist, + ExecInitExpr((Expr *) lfirst(l), + parent)); } /* Don't fall through to the "common" code below */ - return (ExprState *) FastListValue(&outlist); + return (ExprState *) outlist; } default: elog(ERROR, "unrecognized node type: %d", diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index db783ae0ba..249c590770 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * 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 * AUTHOR DATE MAJOR EVENT @@ -108,7 +108,6 @@ static void doNegateFloat(Value *v); OnCommitAction oncommit; ContainsOids withoids; List *list; - FastList fastlist; Node *node; Value *value; ColumnRef *columnref; @@ -6820,15 +6819,11 @@ opt_indirection: expr_list: a_expr { - FastList *dst = (FastList *) &$$; - makeFastList1(dst, $1); + $$ = list_make1($1); } | expr_list ',' a_expr { - FastList *dst = (FastList *) &$$; - FastList *src = (FastList *) &$1; - *dst = *src; - FastAppend(dst, $3); + $$ = lappend($1, $3); } ; diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index 2cf870d884..3856005fab 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -8,7 +8,7 @@ * * * 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, List * transformTargetList(ParseState *pstate, List *targetlist) { - FastList p_target; + List *p_target = NIL; ListCell *o_target; - FastListInit(&p_target); - foreach(o_target, targetlist) { ResTarget *res = (ResTarget *) lfirst(o_target); @@ -116,8 +114,8 @@ transformTargetList(ParseState *pstate, List *targetlist) * Target item is a single '*', expand all tables * (e.g., SELECT * FROM emp) */ - FastConc(&p_target, - ExpandAllTables(pstate)); + p_target = list_concat(p_target, + ExpandAllTables(pstate)); } else { @@ -173,34 +171,34 @@ transformTargetList(ParseState *pstate, List *targetlist) rte = addImplicitRTE(pstate, makeRangeVar(schemaname, relname)); - FastConc(&p_target, - expandRelAttrs(pstate, rte)); + p_target = list_concat(p_target, + expandRelAttrs(pstate, rte)); } } else { /* Plain ColumnRef node, treat it as an expression */ - FastAppend(&p_target, - transformTargetEntry(pstate, - res->val, - NULL, - res->name, - false)); + p_target = lappend(p_target, + transformTargetEntry(pstate, + res->val, + NULL, + res->name, + false)); } } else { /* Everything else but ColumnRef */ - FastAppend(&p_target, - transformTargetEntry(pstate, - res->val, - NULL, - res->name, - false)); + p_target = lappend(p_target, + transformTargetEntry(pstate, + res->val, + NULL, + res->name, + false)); } } - return FastListValue(&p_target); + return p_target; } -- 2.40.0