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/include/parser | |
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/include/parser')
-rw-r--r-- | src/include/parser/parsetree.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h index 74427f23adb..9b488c397ac 100644 --- a/src/include/parser/parsetree.h +++ b/src/include/parser/parsetree.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parsetree.h,v 1.23 2003/11/29 22:41:09 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/parser/parsetree.h,v 1.24 2004/05/26 04:41:46 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #define PARSETREE_H #include "nodes/parsenodes.h" -#include "nodes/pg_list.h" /* for nth(), etc */ +#include "nodes/pg_list.h" /* for list_nth(), etc */ /* ---------------- @@ -30,7 +30,7 @@ * NB: this will crash and burn if handed an out-of-range RT index */ #define rt_fetch(rangetable_index, rangetable) \ - ((RangeTblEntry *) nth((rangetable_index)-1, rangetable)) + ((RangeTblEntry *) list_nth(rangetable, (rangetable_index)-1)) /* * getrelid |