]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
obstack: let glibc user #define __obstack_free
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 May 2025 22:09:02 +0000 (15:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 May 2025 22:16:12 +0000 (15:16 -0700)
* lib/obstack.in.h (__obstack_free)
[! (__GL_GNULIB_HEADER && __GL_REPLACE_OBSTACK__)]:
Allow glibc user to #define __obstack_free.  Although this
vestigial feature is not useful any more, it is one less change to
current glibc usage and so should make it a bit easier to merge
with glibc.

ChangeLog
lib/obstack.in.h

index d60a9e56589222ee8f55ec06ea15a094e96c780e..ac06e3520c60082a7571e92769d5c934d40f4851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2025-05-06  Paul Eggert  <eggert@cs.ucla.edu>
 
+       obstack: let glibc user #define __obstack_free
+       * lib/obstack.in.h (__obstack_free)
+       [! (__GL_GNULIB_HEADER && __GL_REPLACE_OBSTACK__)]:
+       Allow glibc user to #define __obstack_free.  Although this
+       vestigial feature is not useful any more, it is one less change to
+       current glibc usage and so should make it a bit easier to merge
+       with glibc.
+
        obstack: don’t assume INT_MAX < SIZE_MAX
        This for clarity and to document the overflow checking better;
        I think no current Gnulib or glibc targets have SIZE_MAX <= INTMAX,
index 85252ff430d018b8c22acabb98a4e4c8d3a83f47..174cab9d0ab1a3e52cdc2b395948028f62a4518f 100644 (file)
@@ -233,20 +233,19 @@ struct obstack          /* control current object in current chunk */
 
 /* Declare the external functions we use; they are in obstack.c.  */
 
-#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.  */
+#if defined __GL_GNULIB_HEADER && 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
+#endif
+
+/* The default name of the function for freeing a chunk is '_obstack_free',
+   but gnulib overrides this by defining '__obstack_free' above.  */
+#ifndef __obstack_free
 # define __obstack_free _obstack_free
 #endif