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,
/* 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