diff options
author | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
commit | d0b4399d81f39decccb23fa38f772b71b51bf96a (patch) | |
tree | 71d3b737f5d93f6c3984412a4910b5810156c5ca /src/backend/executor/execAmi.c | |
parent | 18d0d105635fbc7e476063e662b449f296953a04 (diff) | |
download | postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.tar.gz postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.zip |
Reimplement the linked list data structure used throughout the backend.
In the past, we used a 'Lispy' linked list implementation: a "list" was
merely a pointer to the head node of the list. The problem with that
design is that it makes lappend() and length() linear time. This patch
fixes that problem (and others) by maintaining a count of the list
length and a pointer to the tail node along with each head node pointer.
A "list" is now a pointer to a structure containing some meta-data
about the list; the head and tail pointers in that structure refer
to ListCell structures that maintain the actual linked list of nodes.
The function names of the list API have also been changed to, I hope,
be more logically consistent. By default, the old function names are
still available; they will be disabled-by-default once the rest of
the tree has been updated to use the new API names.
Diffstat (limited to 'src/backend/executor/execAmi.c')
-rw-r--r-- | src/backend/executor/execAmi.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c index 8bbd1942eba..fdf55b31c0c 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.78 2004/03/02 18:56:15 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.79 2004/05/26 04:41:14 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -64,11 +64,11 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt) /* If we have changed parameters, propagate that info */ if (node->chgParam != NULL) { - List *lst; + ListCell *l; - foreach(lst, node->initPlan) + foreach(l, node->initPlan) { - SubPlanState *sstate = (SubPlanState *) lfirst(lst); + SubPlanState *sstate = (SubPlanState *) lfirst(l); PlanState *splan = sstate->planstate; if (splan->plan->extParam != NULL) /* don't care about child @@ -77,9 +77,9 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt) if (splan->chgParam != NULL) ExecReScanSetParamPlan(sstate, node); } - foreach(lst, node->subPlan) + foreach(l, node->subPlan) { - SubPlanState *sstate = (SubPlanState *) lfirst(lst); + SubPlanState *sstate = (SubPlanState *) lfirst(l); PlanState *splan = sstate->planstate; if (splan->plan->extParam != NULL) @@ -315,7 +315,7 @@ ExecSupportsBackwardScan(Plan *node) case T_Append: { - List *l; + ListCell *l; foreach(l, ((Append *) node)->appendplans) { |