mirror of
https://github.com/ioacademy-jikim/debugging
synced 2025-06-09 00:46:12 +00:00
21 lines
430 B
C
21 lines
430 B
C
/*
|
|
* AC_FUNC_MALLOC in configure defines malloc to rpl_malloc if
|
|
* malloc (0) is NULL to provide GNU compatibility
|
|
*/
|
|
|
|
#include "libcompat.h"
|
|
|
|
/* malloc has been defined to rpl_malloc, so first undo that */
|
|
#undef malloc
|
|
|
|
/* this gives us the real malloc to use below */
|
|
void *malloc(size_t n);
|
|
|
|
/* force malloc(0) to return a valid pointer */
|
|
void *rpl_malloc(size_t n)
|
|
{
|
|
if(n == 0)
|
|
n = 1;
|
|
return malloc(n);
|
|
}
|