summaryrefslogtreecommitdiffstats
path: root/third_party/heimdal/cf/broken-realloc.m4
blob: a397e96882efcbc4f3a4583190bfcd401732829e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
dnl
dnl $Id$
dnl
dnl Test for realloc that doesn't handle NULL as first parameter
dnl
AC_DEFUN([rk_BROKEN_REALLOC], [
AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
ac_cv_func_realloc_broken=no
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stddef.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	return realloc(NULL, 17) == NULL;
}
]])],[:], [ac_cv_func_realloc_broken=yes],[:])
])
if test "$ac_cv_func_realloc_broken" = yes ; then
	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
fi
dnl AH_BOTTOM([#ifdef BROKEN_REALLOC
dnl #ifndef realloc
dnl #define realloc(X, Y) rk_realloc((X), (Y))
dnl #endif
dnl #endif])
])