next draft of list rewrite
От | Neil Conway |
---|---|
Тема | next draft of list rewrite |
Дата | |
Msg-id | 87r7xoad4k.fsf@mailbox.samurai.com обсуждение исходный текст |
Ответы |
Re: next draft of list rewrite
|
Список | pgsql-patches |
I've attached the latest header and implementation files (pg_list.h and list.c, respectively) for the new linked list implementation. I'm pretty satisfied with the new API: now would be the ideal time to suggest any changes you think I should make to it. I decided to use a new naming convention: all public functions and macros are prefixed with list_ or cell_, as appropriate, and type-specific functions are suffixed with _int or _oid, as appropriate. ISTM that the "allocate the list itself and the head node in one palloc()" idea that Tom suggested actually won't work: since the head node can change over the life of the list, we need to be able to deallocate a list cell via pfree() -- which would not be the case if a particular node was allocated via the same palloc() as the list itself. BTW, one nice thing about the new List API is that it lets us get rid of the WRITE_INTLIST_FIELD() and related cruft in nodes/, because each type of list (T_List, T_IntList, or T_OidList) is now a legitimate Node in its own right. So we can now use WRITE_NODE_FIELD() to output a list of integers, for example. (The implementation is a little "off the cuff", and I haven't reviewed it; also, since the tree is totally broken with this patch applied, I haven't tested it either. That said, I'd appreciate anyone mentioning any implementation bugs they might happen to spot.) Incidentally, does anyone have any thoughts on the best way to commit this? It requires changing pretty much _every single_ place in the code that uses the List API. Although most of those modifications should be trivial, it will still require touching a lot of files. Should I just make the changes locally and commit them all in one fell swoop? Create a private branch in CVS? Any other suggestions? FWIW, I'm hoping to have this done (and committed to CVS HEAD) by the end of next weekend. -Neil
Вложения
В списке pgsql-patches по дате отправления: