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 0172e4784f89dbf8513c319d575b5b68ca72b1b6..b0c492705f235e86c72f8675c03e1802036d1a42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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>
 
index d28e1583c86856d19eb50517c17f562c1f2525d2..22451e495d7d2c0c0eebf138b535a31c05d73eb5 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 ecce5296903651062f662098c87dbc29cb0c7f2c..f06d44fb5f0b88958e3b884acf70df77b18f7653 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 e62da1e69dd5ffc323ab19ae912841be498ca9fa..7a5896715fdcabdab8e3c3a81d373eb5d57a59b7 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 07378b4e2ef27c6bbb72fc9832b189c5ca22100b..734d9734b5610fe6962c887e5b34d154e98c2250 100644 (file)
@@ -10,6 +10,7 @@ calloc-posix
 
 configure.ac:
 gl_FUNC_CALLOC_GNU
+gl_MODULE_INDICATOR([calloc-gnu])
 
 Makefile.am: