]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
realloc: Fix link error in C++ mode on CentOS 5 (regression 2024-11-04).
authorBruno Haible <bruno@clisp.org>
Sun, 16 Feb 2025 14:46:06 +0000 (15:46 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Feb 2025 14:48:47 +0000 (15:48 +0100)
* lib/stdlib.in.h (rpl_realloc): Ensure C linkage, not C++ linkage, in
C++ mode.

ChangeLog
lib/stdlib.in.h

index 5829c3bd9e636340e1c3f3dacc3b619e8fc13e9e..549db282dbe2522dbb2b4854ea85fd91574e9db7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-02-16  Bruno Haible  <bruno@clisp.org>
+
+       realloc: Fix link error in C++ mode on CentOS 5 (regression 2024-11-04).
+       * lib/stdlib.in.h (rpl_realloc): Ensure C linkage, not C++ linkage, in
+       C++ mode.
+
 2025-02-16  Bruno Haible  <bruno@clisp.org>
 
        c-strcasecmp, c-strncasecmp: New modules.
index 11d337a18a713083cfdd417e2dfb0b9535038825..2077a63fc63d2f0cb010062b68b64dceefbf901d 100644 (file)
@@ -1473,11 +1473,17 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
 # if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
 #  if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
 #   define _GL_INLINE_RPL_REALLOC 1
+#   ifdef __cplusplus
+extern "C" {
+#   endif
 _GL_REALLOC_INLINE void *
 rpl_realloc (void *ptr, size_t size)
 {
   return realloc (ptr, size ? size : 1);
 }
+#   ifdef __cplusplus
+}
+#   endif
 #  endif
 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
         || _GL_USE_STDLIB_ALLOC)