From deedb0b77c569bf6be408e67cb07bad6c7ce1214 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 13 Dec 2002 08:44:28 +0000 Subject: [PATCH] (alloca): Remove; decl no longer needed. (): Include, for offsetof. (, ): Include if available. (uintptr_t): New type, if system lacks it. (CALLOC, MALLOC, REALLOC): New macros. All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these new macros. --- src/system.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/system.h b/src/system.h index 50149c98..bf1ef4cc 100644 --- a/src/system.h +++ b/src/system.h @@ -22,23 +22,7 @@ # include #endif -/* AIX requires this to be the first thing in the file. */ -#ifdef __GNUC__ -# define alloca(Size) __builtin_alloca (Size) -#else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -#endif - +#include #include /* Verify a requirement at compile-time (unlike assert, which is runtime). */ @@ -81,7 +65,24 @@ char *alloca (); #include +#if HAVE_UINTPTR_T +# if HAVE_INTTYPES_H +# include +# else +# if HAVE_STDINT_H +# include +# endif +# endif +#else +/* This isn't perfect, but it's good enough for Bison, which needs + only to hash pointers. */ +typedef size_t uintptr_t; +#endif + #include +#define CALLOC(P, N) ((P) = xcalloc (N, sizeof *(P))) +#define MALLOC(P, N) ((P) = xmalloc ((N) * sizeof *(P))) +#define REALLOC(P, N) ((P) = xrealloc (P, (N) * sizeof *(P))) /* From xstrndup.c. */ char *xstrndup (const char *s, size_t n); -- 2.47.2