| From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: [PATCH] binary heap implementation |
| Date: | 2012-11-16 06:49:44 |
| Message-ID: | 1353048584.10198.15.camel@jdavis-laptop |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Smith | 2012-11-16 07:20:53 | CommitFest #3 and upcoming schedule |
| Previous Message | Jeff Davis | 2012-11-16 06:44:23 | Re: Do we need so many hint bits? |