NetBSD/crypto/dist/heimdal/cf/broken-realloc.m4

27 lines
696 B
Plaintext
Raw Normal View History

2000-08-02 23:57:59 +04:00
dnl
dnl $Id: broken-realloc.m4,v 1.1.1.1 2000/08/02 20:00:27 assar Exp $
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_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])
])