changeset 13606:81875db181b0

Make the module 'calloc-gnu' work again on AIX and OSF/1.
author Bruno Haible <bruno@clisp.org>
date Sun, 29 Aug 2010 19:29:56 +0200
parents fc6aba4c5936
children cb66652c5f88
files ChangeLog lib/calloc.c lib/xmalloc.c m4/calloc.m4 modules/calloc-gnu
diffstat 5 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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>
 
--- a/lib/calloc.c
+++ b/lib/calloc.c
@@ -20,8 +20,11 @@
 #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 @@
 {
   void *result;
 
-#ifdef NEED_CALLOC_GNU
+#if NEED_CALLOC_GNU
   if (n == 0 || s == 0)
     {
       n = 1;
--- 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 };
--- 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_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
--- a/modules/calloc-gnu
+++ b/modules/calloc-gnu
@@ -10,6 +10,7 @@
 
 configure.ac:
 gl_FUNC_CALLOC_GNU
+gl_MODULE_INDICATOR([calloc-gnu])
 
 Makefile.am: