mirror of
https://github.com/git/git.git
synced 2025-03-15 19:52:30 +00:00
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>
This commit is contained in:
parent
9eceddeec6
commit
d190a0875f
@ -18,17 +18,9 @@
|
|||||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02110-1301, USA. */
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#include "git-compat-util.h"
|
||||||
#ifdef HAVE_CONFIG_H
|
#include <gettext.h>
|
||||||
# include <config.h>
|
#include "obstack.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
|
||||||
# include <obstack.h>
|
|
||||||
# include <shlib-compat.h>
|
|
||||||
#else
|
|
||||||
# include "obstack.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
|
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
|
||||||
incremented whenever callers compiled using an old obstack.h can no
|
incremented whenever callers compiled using an old obstack.h can no
|
||||||
@ -103,15 +95,6 @@ enum
|
|||||||
static void print_and_abort (void);
|
static void print_and_abort (void);
|
||||||
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
|
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
|
# ifdef _LIBC
|
||||||
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
|
# 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
|
/* 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;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Define the error handler. */
|
|
||||||
# ifdef _LIBC
|
|
||||||
# include <libintl.h>
|
|
||||||
# else
|
|
||||||
# include "gettext.h"
|
|
||||||
# endif
|
|
||||||
# ifndef _
|
|
||||||
# define _(msgid) gettext (msgid)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef _LIBC
|
# ifdef _LIBC
|
||||||
# include <libio/iolibio.h>
|
# include <libio/iolibio.h>
|
||||||
# endif
|
# endif
|
||||||
@ -435,7 +408,7 @@ print_and_abort (void)
|
|||||||
# else
|
# else
|
||||||
fprintf (stderr, "%s\n", _("memory exhausted"));
|
fprintf (stderr, "%s\n", _("memory exhausted"));
|
||||||
# endif
|
# endif
|
||||||
exit (obstack_exit_failure);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !ELIDE_CODE */
|
#endif /* !ELIDE_CODE */
|
||||||
|
@ -187,7 +187,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
|
|||||||
void (*) (void *, void *), void *);
|
void (*) (void *, void *), void *);
|
||||||
extern int _obstack_memory_used (struct obstack *);
|
extern int _obstack_memory_used (struct obstack *);
|
||||||
|
|
||||||
void obstack_free (struct obstack *__obstack, void *__block);
|
void obstack_free (struct obstack *, void *);
|
||||||
|
|
||||||
|
|
||||||
/* Error handler called when `obstack_chunk_alloc' failed to allocate
|
/* Error handler called when `obstack_chunk_alloc' failed to allocate
|
||||||
@ -195,9 +195,6 @@ void obstack_free (struct obstack *__obstack, void *__block);
|
|||||||
should either abort gracefully or use longjump - but shouldn't
|
should either abort gracefully or use longjump - but shouldn't
|
||||||
return. The default action is to print a message and abort. */
|
return. The default action is to print a message and abort. */
|
||||||
extern void (*obstack_alloc_failed_handler) (void);
|
extern void (*obstack_alloc_failed_handler) (void);
|
||||||
|
|
||||||
/* Exit value used when `print_and_abort' is used. */
|
|
||||||
extern int obstack_exit_failure;
|
|
||||||
|
|
||||||
/* Pointer to beginning of object being allocated or to be allocated next.
|
/* Pointer to beginning of object being allocated or to be allocated next.
|
||||||
Note that this might not be the final address of the object
|
Note that this might not be the final address of the object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user