From: Bruno Haible Date: Sun, 29 Aug 2010 17:29:56 +0000 (+0200) Subject: Make the module 'calloc-gnu' work again on AIX and OSF/1. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f802acb9d9375cc6813aed36f82e71b2b8c4913;hp=560be60e7e4f34d4d07a74eb950f70d0774626a9;p=pspp Make the module 'calloc-gnu' work again on AIX and OSF/1. --- diff --git a/ChangeLog b/ChangeLog index 0172e4784f..b0c492705f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-08-29 Ralf Wildenhues + Bruno Haible + + Make the module 'calloc-gnu' work again on AIX and OSF/1. + * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Define HAVE_CALLOC_GNU instead of + HAVE_CALLOC. + * lib/xmalloc.c: Update accordingly. + * lib/calloc.c (NEED_CALLOC_GNU): Enable also when + GNULIB_CALLOC_GNU && !HAVE_CALLOC_GNU. + * modules/calloc-gnu (configure.ac): Invoke gl_MODULE_INDICATOR. + 2010-08-29 Ralf Wildenhues Bruno Haible diff --git a/lib/calloc.c b/lib/calloc.c index d28e1583c8..22451e495d 100644 --- a/lib/calloc.c +++ b/lib/calloc.c @@ -20,8 +20,11 @@ #include /* Only the AC_FUNC_CALLOC macro defines 'calloc' already in config.h. */ #ifdef calloc -# define NEED_CALLOC_GNU +# define NEED_CALLOC_GNU 1 # undef calloc +/* Whereas the gnulib module 'calloc-gnu' defines HAVE_CALLOC_GNU. */ +#elif GNULIB_CALLOC_GNU && !HAVE_CALLOC_GNU +# define NEED_CALLOC_GNU 1 #endif /* Specification. */ @@ -40,7 +43,7 @@ rpl_calloc (size_t n, size_t s) { void *result; -#ifdef NEED_CALLOC_GNU +#if NEED_CALLOC_GNU if (n == 0 || s == 0) { n = 1; diff --git a/lib/xmalloc.c b/lib/xmalloc.c index ecce529690..f06d44fb5f 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -30,8 +30,8 @@ /* 1 if calloc is known to be compatible with GNU calloc. This matters if we are not also using the calloc module, which defines - HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ -#if defined HAVE_CALLOC || defined __GLIBC__ + HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */ +#if defined HAVE_CALLOC_GNU || defined __GLIBC__ enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; diff --git a/m4/calloc.m4 b/m4/calloc.m4 index e62da1e69d..7a5896715f 100644 --- a/m4/calloc.m4 +++ b/m4/calloc.m4 @@ -1,4 +1,4 @@ -# calloc.m4 serial 10 +# calloc.m4 serial 11 # Copyright (C) 2004-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -35,10 +35,10 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) _AC_FUNC_CALLOC_IF( - [AC_DEFINE([HAVE_CALLOC], [1], + [AC_DEFINE([HAVE_CALLOC_GNU], [1], [Define to 1 if your system has a GNU libc compatible `calloc' function, and to 0 otherwise.])], - [AC_DEFINE([HAVE_CALLOC], [0]) + [AC_DEFINE([HAVE_CALLOC_GNU], [0]) gl_REPLACE_CALLOC ]) ])# gl_FUNC_CALLOC_GNU diff --git a/modules/calloc-gnu b/modules/calloc-gnu index 07378b4e2e..734d9734b5 100644 --- a/modules/calloc-gnu +++ b/modules/calloc-gnu @@ -10,6 +10,7 @@ calloc-posix configure.ac: gl_FUNC_CALLOC_GNU +gl_MODULE_INDICATOR([calloc-gnu]) Makefile.am: