On 4/18/2014 1:44 AM, Paul Eggert wrote:
the MALLOC_0_IS_NONNULL macro attempting to check for
malloc(0) failure is not needed.
It's not needed for correctness, but it helps performance on GNU
hosts, no? It lets them avoid an unnecessary test "size != 0" at
runtime. The MALLOC_0_IS_NONNULL test is done at compile-time, and
has no runtime overhead.
If saving that one test is worth the risk that MALLOC_0_IS_NONNULL will
always be correctly be defined, e.g. that this will never always be true
for all potential users:
+#ifdef _LIBC
+# define MALLOC_0_IS_NONNULL 1
uClibc defines it too:
libc-symbols.h:#define _LIBC 1
Nathan