Re: [CFReview] Red-Black Tree

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Mark Cave-Ayland <mark(dot)cave-ayland(at)siriusit(dot)co(dot)uk>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [CFReview] Red-Black Tree
Date: 2010-02-09 03:35:54
Message-ID: 603c8f071002081935m490bc392g9eefff50054d8015@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 8, 2010 at 3:05 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2010-02-09 03:37:32 Re: review: More frame options in window functions
Previous Message M Z 2010-02-09 03:24:45 CVS checkout source code for different branches