Re: Some new list.c primitives

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some new list.c primitives
Date: 2005-07-28 00:25:32
Message-ID: 20050728002532.GD6635@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 27, 2005 at 06:01:21PM -0400, Tom Lane wrote:
> 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);
> }

How about list_push for both of these? This opens the door for
possible future functionality like list_pop, list_shift,
list_unshift...

Just my uneducated $.02.

Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2005-07-28 00:26:26 Re: ORDER BY <field not in return list>
Previous Message Alvaro Herrera 2005-07-28 00:22:54 Autovacuum to-do list