From e61ac27675c6b35edc888eb0210d3c03b47e8c6d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 16 Nov 2024 15:16:05 +0100 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ lib/calloc.c | 5 ++--- lib/malloc.c | 1 + lib/realloc.c | 1 + lib/stdlib.in.h | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c74117ac6b..b66fe3f4ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-11-16 Bruno Haible + + 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 mktime: don’t consult daylight diff --git a/lib/calloc.c b/lib/calloc.c index 124c1f9958..451c2195a7 100644 --- a/lib/calloc.c +++ b/lib/calloc.c @@ -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 /* Specification. */ @@ -25,9 +27,6 @@ #include #include -/* 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. */ diff --git a/lib/malloc.c b/lib/malloc.c index fdb5348268..045ff82c1a 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -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 diff --git a/lib/realloc.c b/lib/realloc.c index 31487b5e18..58044745f4 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -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 diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index b4e2e723fc..a34fe66bfb 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -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 -- 2.39.5