Re: linked list rewrite

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: linked list rewrite
Date: 2004-03-23 23:08:32
Message-ID: 7683.1080083312@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

I wrote:
> Let's see ... fleshing out this idea a bit, here's a rundown of all the
> symbols in pg_list.h and suggested new names:

Sheesh ... I forgot that I intended to do s/list_/l/g on that.

Doing so brings up one problem, which is that the old version of
lremove() conflicts with the new naming convention (it should have
had a name mentioning "ptr"). In the attached I work around this
by using "ldelete" rather than "lremove" as the base name for these
functions, but I'm open to other ideas.

ListCell accessors:

lfirst no change
lfirsti lfirst_int
lfirsto lfirst_oid
lnext no change
foreach no change

List accessors:

length no change

lfirstcell new function to get first cell, or NULL if none

lfirst rewrite as lfirst(lfirstcell()) when applied to a List

lsecond, lthird, lfourth not clear if worth keeping

llastnode llastcell

llast Perhaps rewrite as lfirst(llastcell()) instead of keeping

makeListN lmakeN or possibly lmake_N
makeListiN lmakeN_int or lmake_N_int
makeListoN lmakeN_oid or lmake_N_oid

lcons no change
lconsi lcons_int
lconso lcons_oid

lappend no change
lappendi lappend_int
lappendo lappend_oid

nconc lconcat
We might also need a function to attach some bare ListCells to a List

nth lnth
lnth_int
lnth_oid
Should add lnth_int, lnth_oid, even though there are no
corresponding functions at the moment

member lmember
ptrMember lmember_ptr
intMember lmember_int
oidMember lmember_oid

LispRemove ldelete
lremove ldelete_ptr
lremovei ldelete_int
ldelete_oid add, though not currently used

ltruncate no change

set_union lunion
set_ptrUnion lunion_ptr
lunion_int not currently used
set_uniono lunion_oid

set_difference ldifference
set_ptrDifference ldifference_ptr
ldifference_int not currently used
set_differenceo ldifference_oid

equali and equalo become just calls on equal()

freeList lfree (frees only List, not pointed-to objects)

listCopy lcopy (shallow copy of List only)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-03-23 23:11:08 Re: partial VACUUM FULL
Previous Message Bill Moran 2004-03-23 23:06:53 Re: partial VACUUM FULL

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-23 23:50:44 Re: linked list rewrite
Previous Message Andrew Dunstan 2004-03-23 22:15:00 Re: dollar quoting and pg_dump