Re: [CFReview] Red-Black Tree

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Teodor Sigaev <teodor@sigaev.ru>, Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2010-02-09T03:35:54Z
Lists: pgsql-hackers
On Mon, Feb 8, 2010 at 3:05 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> It seems a bit strange to have all the rb_free_recursive support and not
> use it anywhere ... and a freefunc callback even, whose only caller
> seems to set as null currently.  Hmm, even in the knngist patch the
> rb_freefunc stuff is unused.

I don't think it's inappropriate;  it doesn't seem implausible that
someone might want to free an rbtree someday.  I suppose we could
comment it out but I guess I don't see the point.

> How do we now that it works?

Visual inspection?  It's not very complicated.

> (What, for example, if we were to allocate multiple nodes in a single
> palloc chunk?  I'm not familiar with this stuff but that seems
> plausible)

Well, then you could have the freefunc do something ((MyStruct *)
a)->is_allocated = false.

...Robert