Commit Graph

2 Commits

Author SHA1 Message Date
Darren Tucker e9dede06e5 Handle calloc(0,x) where different from malloc.
Configure assumes that if malloc(0) returns null then calloc(0,n)
also does.  On some old platforms (SunOS4) malloc behaves as expected
(as determined by AC_FUNC_MALLOC) but calloc doesn't.  Test for this
at configure time and activate the replacement function if found, plus
handle this case in rpl_calloc.
2018-02-26 00:09:04 +11:00
Darren Tucker 74c1c3660a Check for and handle calloc(p, 0) = NULL.
On some platforms (AIX, maybe others) allocating zero bytes of memory
via the various *alloc functions returns NULL, which is permitted
by the standards.  Autoconf has some macros for detecting this (with
the exception of calloc for some reason) so use these and if necessary
activate shims for them.  ok djm@
2017-09-27 07:44:41 +10:00