This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: obstack.c defines a variable that isn't used
Ulrich Drepper <drepper@redhat.com> writes:
>> * malloc/obstack.c (_obstack): Remove unused variable.
>> It hasn't been used by glibc since at least 1.06.4 (dated 1993).
>
> Not applied. We export this variable and somebody might use it.
OK, but the variable's comment is incorrect as the macros don't
currently use that variable. Also, non-glibc users don't need the
variable. Here's a revised patch.
2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
* malloc/obstack.c (_obstack) [!defined _LIBC]: Remove; not used.
Add comment explaining why libc still defines it.
Index: malloc/obstack.c
===================================================================
RCS file: /cvs/glibc/libc/malloc/obstack.c,v
retrieving revision 1.25
diff -p -u -r1.25 obstack.c
--- malloc/obstack.c 28 Jan 2004 03:52:48 -0000 1.25
+++ malloc/obstack.c 20 May 2004 17:37:11 -0000
@@ -95,10 +95,12 @@ int obstack_exit_failure = EXIT_FAILURE;
# define obstack_exit_failure exit_failure
# endif
-/* The non-GNU-C macros copy the obstack into this global variable
- to avoid multiple evaluation. */
-
+# ifdef _LIBC
+/* A looong time ago (before 1994, anyway; we're not sure) this global variable
+ was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
+ library still exports it because somebody might use it. */
struct obstack *_obstack;
+# endif
/* Define a macro that either calls functions with the traditional malloc/free
calling interface, or calls functions with the mmalloc/mfree interface