summaryrefslogtreecommitdiff
path: root/compat/obstack.c
diff options
context:
space:
mode:
authorFredrik Kuivinen <frekui@gmail.com>2011-08-28 20:08:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-29 05:03:26 (GMT)
commitd190a0875ff0f33d60a4d7265f2098b35d162f68 (patch)
tree6fe98fa333137aa28150f2fa3c88cff1558c03c4 /compat/obstack.c
parent9eceddeec6ccdbcb0c6ce02a45357ffd5a428f39 (diff)
downloadgit-d190a0875ff0f33d60a4d7265f2098b35d162f68.zip
git-d190a0875ff0f33d60a4d7265f2098b35d162f68.tar.gz
git-d190a0875ff0f33d60a4d7265f2098b35d162f68.tar.bz2
obstack: Fix portability issues
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, SunOS 5.10, and possibly others do not have exit.h and exitfail.h. Remove the use of these in obstack.c. The __block variable was renamed to block to avoid a gcc error: compat/obstack.h:190: error: __block attribute can be specified on variables only Initial-patch-by: David Aguilar <davvid@gmail.com> Reported-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Fredrik Kuivinen <frekui@gmail.com> Acked-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/obstack.c')
-rw-r--r--compat/obstack.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/compat/obstack.c b/compat/obstack.c
index 75440d9..a89ab5b 100644
--- a/compat/obstack.c
+++ b/compat/obstack.c
@@ -18,17 +18,9 @@
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# include <obstack.h>
-# include <shlib-compat.h>
-#else
-# include "obstack.h"
-#endif
+#include "git-compat-util.h"
+#include <gettext.h>
+#include "obstack.h"
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
incremented whenever callers compiled using an old obstack.h can no
@@ -103,15 +95,6 @@ enum
static void print_and_abort (void);
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
-/* Exit value used when `print_and_abort' is used. */
-# include <stdlib.h>
-# 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
@@ -400,16 +383,6 @@ _obstack_memory_used (struct obstack *h)
return nbytes;
}
-/* Define the error handler. */
-# ifdef _LIBC
-# include <libintl.h>
-# else
-# include "gettext.h"
-# endif
-# ifndef _
-# define _(msgid) gettext (msgid)
-# endif
-
# ifdef _LIBC
# include <libio/iolibio.h>
# endif
@@ -435,7 +408,7 @@ print_and_abort (void)
# else
fprintf (stderr, "%s\n", _("memory exhausted"));
# endif
- exit (obstack_exit_failure);
+ exit (1);
}
#endif /* !ELIDE_CODE */