From: Paul Eggert Date: Tue, 6 May 2025 22:09:02 +0000 (-0700) Subject: obstack: let glibc user #define __obstack_free X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acaa6c07d85fa5eeadae4e60b717fb25c919c23d;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index d60a9e5658..ac06e3520c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2025-05-06 Paul Eggert + 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, diff --git a/lib/obstack.in.h b/lib/obstack.in.h index 85252ff430..174cab9d0a 100644 --- a/lib/obstack.in.h +++ b/lib/obstack.in.h @@ -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