From 05fdbef0c8abf8b762ae5b4208f18d1aa11dbb63 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim@meyering.net>
Date: Fri, 22 Aug 1997 14:55:01 +0000
Subject: [PATCH] update from glibc

---
 lib/obstack.c |  2 +-
 lib/obstack.h | 15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/obstack.c b/lib/obstack.c
index 1e36c4a0a5..1ff4155611 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -85,7 +85,7 @@ void (*obstack_alloc_failed_handler) () = print_and_abort;
 #endif
 
 /* Exit value used when `print_and_abort' is used.  */
-#if defined (__STDC__) && __STDC__
+#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
 #ifndef EXIT_FAILURE
diff --git a/lib/obstack.h b/lib/obstack.h
index 0e7eb09054..53d25b449d 100644
--- a/lib/obstack.h
+++ b/lib/obstack.h
@@ -107,6 +107,10 @@ Summary:
 #ifndef __OBSTACK_H__
 #define __OBSTACK_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* We use subtraction of (char *) 0 instead of casting to int
    because on word-addressable machines a simple cast to int
    may ignore the byte-within-word field of the pointer.  */
@@ -303,13 +307,14 @@ extern int obstack_exit_failure;
 
 #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
   _obstack_begin_1 ((h), (size), (alignment), \
-		    (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
+		    (void *(*) (void *, long)) (chunkfun), \
+		    (void (*) (void *, void *)) (freefun), (arg))
 
 #define obstack_chunkfun(h, newchunkfun) \
-  ((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
+  ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
 
 #define obstack_freefun(h, newfreefun) \
-  ((h) -> freefun = (void (*)(void *)) (newfreefun))
+  ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
 
 #else
 
@@ -578,4 +583,8 @@ __extension__								\
 
 #endif /* not __GNUC__ or not __STDC__ */
 
+#ifdef __cplusplus
+}	/* C++ */
+#endif
+
 #endif /* not __OBSTACK_H__ */
-- 
2.39.5