Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Namely, that on platforms where malloc(0) returns NULL instead of
> a pointer to a zero-size block, pg_malloc thinks it's a failure
> and aborts the program.
What's the use case for malloc(0) anyway?
> 1. Teach pg_malloc not to complain if result == NULL and size == 0.
What about not calling malloc at all in such places? Well I guess what
you want is for the pg_malloc() API to be able to never return NULL…
> 2. Before the malloc call, have it replace size == 0 with size = 1.
As I don't understand the need to malloc 0 byte I would think that's ok
as a way to simplify code…
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support