From: Bruno Haible Date: Tue, 6 May 2025 17:52:10 +0000 (+0200) Subject: obstack: Fix library namespacing (regression yesterday). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9afcbfd60dbcb62627d37a06e751f2404c300f3a;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index f9da2b846b..68b375e9b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-05-06 Bruno Haible + + 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 obstack: match obstack.c with glibc diff --git a/lib/obstack.c b/lib/obstack.c index 9c15886717..8346c898ea 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -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) diff --git a/lib/obstack.in.h b/lib/obstack.in.h index d5a0ceff6d..85252ff430 100644 --- a/lib/obstack.in.h +++ b/lib/obstack.in.h @@ -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,