]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
obstack: Fix library namespacing (regression yesterday).
authorBruno Haible <bruno@clisp.org>
Tue, 6 May 2025 17:52:10 +0000 (19:52 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 6 May 2025 17:52:10 +0000 (19:52 +0200)
* lib/obstack.in.h (__obstack_free): Define to _obstack_free, not
obstack_free, within glibc and in gnulib on systems without glibc.
* lib/obstack.c (obstack_free): Undefine only for the strong_alias.
(obstack_free): Define as an alias of _obstack_free, not vice versa.

ChangeLog
lib/obstack.c
lib/obstack.in.h

index f9da2b846b003d6bc4be49340786bcc33a41dcc6..68b375e9b52ceed44ff656214a233616b822c770 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-05-06  Bruno Haible  <bruno@clisp.org>
+
+       obstack: Fix library namespacing (regression yesterday).
+       * lib/obstack.in.h (__obstack_free): Define to _obstack_free, not
+       obstack_free, within glibc and in gnulib on systems without glibc.
+       * lib/obstack.c (obstack_free): Undefine only for the strong_alias.
+       (obstack_free): Define as an alias of _obstack_free, not vice versa.
+
 2025-05-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        obstack: match obstack.c with glibc
index 9c158867174655e6cac5fdb9d03d34bf7b8aeea7..8346c898ea775e2e7dc8c41cd4cf662a77591a2a 100644 (file)
@@ -288,8 +288,6 @@ _obstack_allocated_p (struct obstack *h, void *obj)
 /* Free objects in obstack H, including OBJ and everything allocate
    more recently than OBJ.  If OBJ is zero, free everything in H.  */
 
-#undef obstack_free
-
 void
 __obstack_free (struct obstack *h, void *obj)
 {
@@ -322,7 +320,8 @@ __obstack_free (struct obstack *h, void *obj)
 
 /* Older versions of libc used a function _obstack_free intended to be
    called by non-GCC compilers.  */
-strong_alias (obstack_free, _obstack_free)
+#undef obstack_free
+strong_alias (_obstack_free, obstack_free)
 
 _OBSTACK_INDEX_T
 _obstack_memory_used (struct obstack *h)
index d5a0ceff6d8d974630ef71a66e4f6b8e0378e295..85252ff430d018b8c22acabb98a4e4c8d3a83f47 100644 (file)
@@ -233,16 +233,23 @@ struct obstack          /* control current object in current chunk */
 
 /* Declare the external functions we use; they are in obstack.c.  */
 
-#if defined __GL_REPLACE_OBSTACK__
-# define _obstack_newchunk rpl_obstack_newchunk
-# define __obstack_free rpl_obstack_free
-# define _obstack_begin rpl_obstack_begin
-# define _obstack_begin_1 rpl_obstack_begin_1
-# define _obstack_memory_used rpl_obstack_memory_used
-# define _obstack_allocated_p rpl_obstack_allocated_p
-#elif !defined __obstack_free /* for old Gnulib */
-# define __obstack_free obstack_free
+#if defined __GL_GNULIB_HEADER
+/* Symbol mapping for gnulib.  */
+# if defined __GL_REPLACE_OBSTACK__
+#  define _obstack_newchunk rpl_obstack_newchunk
+#  define __obstack_free rpl_obstack_free
+#  define _obstack_begin rpl_obstack_begin
+#  define _obstack_begin_1 rpl_obstack_begin_1
+#  define _obstack_memory_used rpl_obstack_memory_used
+#  define _obstack_allocated_p rpl_obstack_allocated_p
+# else
+#  define __obstack_free _obstack_free
+# endif
+#else
+/* Symbol mapping for glibc.  */
+# define __obstack_free _obstack_free
 #endif
+
 extern void _obstack_newchunk (struct obstack *, _OBSTACK_INDEX_T);
 extern int _obstack_begin (struct obstack *,
                            _OBSTACK_INDEX_T, _OBSTACK_INDEX_T,