From: Matthias Braun Date: Fri, 2 Mar 2007 18:23:29 +0000 (+0000) Subject: remove lots of glibc specific stuff from obstack X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c2d881a4962b11849c1be873261db84040c4af74;p=supertux.git remove lots of glibc specific stuff from obstack SVN-Revision: 4906 --- diff --git a/src/obstack/obstack.c b/src/obstack/obstack.c index 75440d9c7..e0cac0725 100644 --- a/src/obstack/obstack.c +++ b/src/obstack/obstack.c @@ -17,52 +17,20 @@ License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - - #ifdef HAVE_CONFIG_H # include #endif -#ifdef _LIBC -# include -# include -#else -# include "obstack.h" -#endif +#include "obstack.h" /* NOTE BEFORE MODIFYING THIS FILE: This version number must be incremented whenever callers compiled using an old obstack.h can no longer properly call the functions in this obstack.c. */ #define OBSTACK_INTERFACE_VERSION 1 -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself, and the installed library - supports the same library interface we do. This code is part of the GNU - C Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object - files, it is simpler to just do this in the source for each such file. */ - #include /* Random thing to get __GNU_LIBRARY__. */ -#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 -# include -# if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - #include - -#ifndef ELIDE_CODE - - -# if HAVE_INTTYPES_H -# include -# endif -# if HAVE_STDINT_H || defined _LIBC -# include -# endif +#include /* Determine default alignment. */ union fooround @@ -105,22 +73,7 @@ void (*obstack_alloc_failed_handler) (void) = print_and_abort; /* Exit value used when `print_and_abort' is used. */ # include -# ifdef _LIBC int obstack_exit_failure = EXIT_FAILURE; -# else -# include "exitfail.h" -# define obstack_exit_failure exit_failure -# endif - -# ifdef _LIBC -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) -/* 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_compat; -compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0); -# endif -# endif /* Define a macro that either calls functions with the traditional malloc/free calling interface, or calls functions with the mmalloc/mfree interface @@ -316,9 +269,6 @@ _obstack_newchunk (struct obstack *h, int length) /* The new chunk certainly contains no empty object yet. */ h->maybe_empty_object = 0; } -# ifdef _LIBC -libc_hidden_def (_obstack_newchunk) -# endif /* Return nonzero if object OBJ has been allocated from obstack H. This is here for debugging. @@ -381,12 +331,6 @@ obstack_free (struct obstack *h, void *obj) abort (); } -# ifdef _LIBC -/* Older versions of libc used a function _obstack_free intended to be - called by non-GCC compilers. */ -strong_alias (obstack_free, _obstack_free) -# endif - int _obstack_memory_used (struct obstack *h) { @@ -399,27 +343,6 @@ _obstack_memory_used (struct obstack *h) } return nbytes; } - -/* Define the error handler. */ -# ifdef _LIBC -# include -# else -# include "gettext.h" -# endif -# ifndef _ -# define _(msgid) gettext (msgid) -# endif - -# ifdef _LIBC -# include -# endif - -# ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -# endif static void __attribute__ ((noreturn)) @@ -430,12 +353,7 @@ print_and_abort (void) happen because the "memory exhausted" message appears in other places like this and the translation should be reused instead of creating a very similar string which requires a separate translation. */ -# ifdef _LIBC - (void) __fxprintf (NULL, "%s\n", _("memory exhausted")); -# else - fprintf (stderr, "%s\n", _("memory exhausted")); -# endif + fprintf (stderr, "%s\n", "memory exhausted"); exit (obstack_exit_failure); } -#endif /* !ELIDE_CODE */