]> Savannah Git Hosting - gnulib.git/commitdiff
calloc-gnu: Fix bug on 32-bit AIX (regression 2024-11-04).
authorBruno Haible <bruno@clisp.org>
Sat, 16 Nov 2024 14:16:05 +0000 (15:16 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 16 Nov 2024 14:17:59 +0000 (15:17 +0100)
* lib/stdlib.in.h (calloc): Consider _GL_USE_STDLIB_ALLOC.
* lib/calloc.c: Define _GL_USE_STDLIB_ALLOC. Don't undefine calloc.
* lib/malloc.c: Add comment.
* lib/realloc.c: Likewise.

ChangeLog
lib/calloc.c
lib/malloc.c
lib/realloc.c
lib/stdlib.in.h

index c74117ac6b3b53cf4512f62f4b23441cc9f11a39..b66fe3f4caacf3dcdc0e8a5c92fd00afe117e12f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-11-16  Bruno Haible  <bruno@clisp.org>
+
+       calloc-gnu: Fix bug on 32-bit AIX (regression 2024-11-04).
+       * lib/stdlib.in.h (calloc): Consider _GL_USE_STDLIB_ALLOC.
+       * lib/calloc.c: Define _GL_USE_STDLIB_ALLOC. Don't undefine calloc.
+       * lib/malloc.c: Add comment.
+       * lib/realloc.c: Likewise.
+
 2024-11-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        mktime: don’t consult daylight
index 124c1f995887088021317f64f27508743e5a5761..451c2195a714a3da765adcf6f3a69d257d6f27d8 100644 (file)
@@ -17,6 +17,8 @@
 
 /* written by Jim Meyering and Bruno Haible */
 
+/* Ensure that we call the system's calloc() below.  */
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Specification.  */
@@ -25,9 +27,6 @@
 #include <errno.h>
 #include <stdckdint.h>
 
-/* Call the system's calloc below.  */
-#undef calloc
-
 /* Allocate and zero-fill an NxS-byte block of memory from the heap,
    even if N or S is zero.  */
 
index fdb53482688b9abc481bce8515bf862a0350b232..045ff82c1a79ddd4f4629de939ca433a9db1b8b9 100644 (file)
@@ -17,6 +17,7 @@
 
 /* written by Jim Meyering and Bruno Haible */
 
+/* Ensure that we call the system's malloc() below.  */
 #define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
index 31487b5e181a3a35be1a8813a9d4c1b887ce5456..58044745f458678753c30a4194a8232a6c205720 100644 (file)
@@ -18,6 +18,7 @@
 
 /* written by Jim Meyering and Bruno Haible */
 
+/* Ensure that we call the system's realloc() below.  */
 #define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
index b4e2e723fcb4c0252de529d72e2b27e87e4e4324..a34fe66bfb924715c1d4360d44be24081630ee48 100644 (file)
@@ -377,7 +377,8 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
 #if @GNULIB_CALLOC_POSIX@
 # if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
      || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
 #   undef calloc
 #   define calloc rpl_calloc
 #  endif