Re: linked list rewrite

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: linked list rewrite
Дата
Msg-id 7683.1080083312@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: linked list rewrite  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: linked list rewrite  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: linked list rewrite
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: linked list rewrite