Some new list.c primitives

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Some new list.c primitives
Дата
Msg-id 11663.1122501681@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Some new list.c primitives  (Gavin Sherry <swm@linuxworld.com.au>)
Re: Some new list.c primitives  (David Fetter <david@fetter.org>)
Список pgsql-hackers
Neil (or anyone else with an opinion),

I'm finding several uses in the planner for some new List primitives
defined as below.  I'd like to push these into list.c, but before that,
has anyone got any serious objections?  How about suggestions for better
names?
        regards, tom lane



/** list_add adds the datum to the list if it's not already a member* (membership is determined by equal()).*/
static List *
list_add(List *list, void *datum)
{   if (list_member(list, datum))       return list;   else       return lappend(list, datum);
}

/** list_add_all does list_add for each element of list2.  This is effectively* the same as list_union(), except that
list1is modified in-place rather* than being copied.*/
 
static List *
list_add_all(List *list1, List *list2)
{   ListCell   *cell;
   foreach(cell, list2)   {       if (!list_member(list1, lfirst(cell)))           list1 = lappend(list1,
lfirst(cell));  }
 
   return list1;
}


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

Предыдущее
От: Mark Wong
Дата:
Сообщение: Re: wal_buffer tests in
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: wal_buffer tests in