Re: [PATCH] binary heap implementation - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: [PATCH] binary heap implementation
Date
Msg-id 1353048584.10198.15.camel@jdavis-laptop
Whole thread Raw
In response to Re: [PATCH] binary heap implementation  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Thu, 2012-11-15 at 17:50 +0100, Andres Freund wrote:
> Me neither. I was thinking about letting the "user" allocate enough
> memory like:
> 
> binaryheap *heap = palloc(binaryheap_size(/*capacity*/ 10));
> binaryheap_init(heap, 10, comparator);
> 
> But thats pretty ugly.

Why not pass the allocator in as a function pointer? It could either be
an argument to the initialization, or we could make a new global
variable that's present inside the server and outside.

(Slight complication: palloc is a macro)

Regards,Jeff Davis




pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Do we need so many hint bits?
Next
From: Greg Smith
Date:
Subject: CommitFest #3 and upcoming schedule