Re: ilist.h is not useful as-is

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: ilist.h is not useful as-is
Дата
Msg-id 20130724161924.GC10713@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: ilist.h is not useful as-is  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: ilist.h is not useful as-is  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On 2013-07-24 11:53:39 -0400, Alvaro Herrera wrote:
> Andres Freund wrote:
> > On 2013-07-24 11:26:00 -0400, Tom Lane wrote:
> 
> > > So I'm going to end up hand-implementing the same kind of manipulation
> > > we frequently use with traditional Lists, namely keep a second variable
> > > that's the preceding list element (not the next one) so I can unlink and
> > > delete the target element when I find it.  ilist.h is not offering me
> > > any useful support at all for this scenario.  Seems like we're missing
> > > a bet here.
> > 
> > Hm. Yes. This should be added. I didn't need it so far, but I definitely
> > can see usecases.
> > 
> > slist_delete_current(slist_mutable_iter *)?
> > 
> > I am willing to cough up a patch if you want.
> > 
> > This will require another member variable in slist_mutable_iter which
> > obviously will need to be maintained, but that seems fine to me since it
> > will reduce the cost of actually deleting noticeably.
> 
> Amusingly, this will mean ForgetBackgroundWorker() will need to have a
> slist_mutable_iter * argument if it wants to use the new function ...

The only alternative I see would be to pass both the prev, and the cur
elements which seems to be less expressive from my POV.
I am open to other suggestions?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ilist.h is not useful as-is
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: ilist.h is not useful as-is