summaryrefslogtreecommitdiff
path: root/lib/obstack.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-11 22:24:14 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-11 22:24:14 +0000
commitfdb9542df70af3e08ea070da2cde69d5d9936605 (patch)
tree6668da4a8df4cd742f1bf83c47a9f1f9ccab5a7d /lib/obstack.c
parent254e577b8655cae3dbdf928a58d862b9f3dc73c7 (diff)
downloadcoreutils-fdb9542df70af3e08ea070da2cde69d5d9936605.tar.xz
Include <inttypes.h> and <stdint.h> if available.
(union fooround): Use uintmax_t, not long int. The rest is a merge from libc: [defined _LIBC]: Include <shlib-compat.h>. (_obstack) [defined _LIBC]: Remove after 2.3.4.
Diffstat (limited to 'lib/obstack.c')
-rw-r--r--lib/obstack.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/obstack.c b/lib/obstack.c
index 8ce49ad8c..9137ce348 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -24,6 +24,7 @@
#ifdef _LIBC
# include <obstack.h>
+# include <shlib-compat.h>
#else
# include "obstack.h"
#endif
@@ -59,10 +60,17 @@
#ifndef ELIDE_CODE
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# endif
+# if HAVE_STDINT_H || defined _LIBC
+# include <stdint.h>
+# endif
+
/* Determine default alignment. */
union fooround
{
- long int i;
+ uintmax_t i;
long double d;
void *p;
};
@@ -103,10 +111,13 @@ int 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;
+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