Heikki Linnakangas wrote:
> On 08/05/2014 03:50 PM, Michael Paquier wrote:
> >- XLogRecGetBlockRefIds needing an already-allocated array for *out is not
> >user-friendly. Cannot we just do all the work inside this function?
>
> I agree it's not a nice API. Returning a palloc'd array would be
> nicer, but this needs to work outside the backend too (e.g.
> pg_xlogdump). It could return a malloc'd array in frontend code, but
> it's not as nice. On the whole, do you think that be better than the
> current approach?
I don't see the issue. Right now, in frontend code you can call
palloc() and pfree(), and they behave like malloc() and free() (see
fe_memutils.c). Your module doesn't need to do anything special.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services