freebsd-nq/crypto/heimdal/cf/broken-realloc.m4

27 lines
698 B
Plaintext
Raw Normal View History

2001-02-13 16:46:19 +00:00
dnl
2004-04-03 21:22:55 +00:00
dnl $Id: broken-realloc.m4,v 1.1.12.1 2004/04/01 07:27:32 joda Exp $
2001-02-13 16:46:19 +00:00
dnl
dnl Test for realloc that doesn't handle NULL as first parameter
dnl
2004-04-03 21:22:55 +00:00
AC_DEFUN([rk_BROKEN_REALLOC], [
2001-02-13 16:46:19 +00:00
AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
ac_cv_func_realloc_broken=no
AC_TRY_RUN([
#include <stddef.h>
#include <stdlib.h>
int main()
{
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
AH_BOTTOM([#ifdef BROKEN_REALLOC
#define realloc(X, Y) isoc_realloc((X), (Y))
#define isoc_realloc(X, Y) ((X) ? realloc((X), (Y)) : malloc(Y))
#endif])
])