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/utils/misc/guc.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/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 8a51e8aa049..1cfc3e0346b 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.206 2004/05/21 05:08:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.207 2004/05/26 04:41:43 neilc Exp $ * *-------------------------------------------------------------------- */ @@ -3290,7 +3290,7 @@ flatten_set_variable_args(const char *name, List *args) struct config_generic *record; int flags; StringInfoData buf; - List *l; + ListCell *l; /* * Fast path if just DEFAULT. We do not check the variable name in @@ -3310,7 +3310,7 @@ flatten_set_variable_args(const char *name, List *args) /* Complain if list input and non-list variable */ if ((flags & GUC_LIST_INPUT) == 0 && - lnext(args) != NIL) + list_length(args) != 1) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("SET %s takes only one argument", name))); @@ -3322,7 +3322,7 @@ flatten_set_variable_args(const char *name, List *args) A_Const *arg = (A_Const *) lfirst(l); char *val; - if (l != args) + if (l != list_head(args)) appendStringInfo(&buf, ", "); if (!IsA(arg, A_Const)) @@ -4430,7 +4430,7 @@ assign_log_destination(const char *value, bool doit, GucSource source) { char *rawstring; List *elemlist; - List *l; + ListCell *l; unsigned int newlogdest = 0; /* Need a modifiable copy of string */ |