Make the module 'calloc-gnu' work again on AIX and OSF/1.
authorBruno Haible <bruno@clisp.org>
Sun, 29 Aug 2010 17:29:56 +0000 (19:29 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 29 Aug 2010 19:04:58 +0000 (21:04 +0200)
ChangeLog
lib/calloc.c
lib/xmalloc.c
m4/calloc.m4
modules/calloc-gnu

index 0172e47..b0c4927 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2010-08-29  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
             Bruno Haible  <bruno@clisp.org>
 
+       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 <Ralf.Wildenhues@gmx.de>
+            Bruno Haible  <bruno@clisp.org>
+
        Make the module 'malloc-gnu' work again on AIX and OSF/1.
        * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_GNU instead of
        HAVE_MALLOC.
index d28e158..22451e4 100644 (file)
 #include <config.h>
 /* 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;
index ecce529..f06d44f 100644 (file)
@@ -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 };
index e62da1e..7a58967 100644 (file)
@@ -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
index 07378b4..734d973 100644 (file)
@@ -10,6 +10,7 @@ calloc-posix
 
 configure.ac:
 gl_FUNC_CALLOC_GNU
+gl_MODULE_INDICATOR([calloc-gnu])
 
 Makefile.am: