summaryrefslogtreecommitdiff
path: root/libiberty/xmalloc.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2005-05-24 21:01:33 +0000
committerDJ Delorie <dj@delorie.com>2005-05-24 21:01:33 +0000
commitcf3e417217878eda27dbf11a1fc8051bbe329648 (patch)
treea8edbdff8932f8c03ae76964a3cb541e21da134c /libiberty/xmalloc.c
parent4bb30907acdef3f90a7cdf602c85dae7c771058b (diff)
downloadbinutils-redhat-cf3e417217878eda27dbf11a1fc8051bbe329648.tar.gz
merge from gcc
Diffstat (limited to 'libiberty/xmalloc.c')
-rw-r--r--libiberty/xmalloc.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c
index adba5188df..3e97aab563 100644
--- a/libiberty/xmalloc.c
+++ b/libiberty/xmalloc.c
@@ -75,11 +75,23 @@ function will be called to print an error message and terminate execution.
#include <unixlib.h>
#else
/* For systems with larger pointers than ints, these must be declared. */
-PTR malloc (size_t);
-PTR realloc (PTR, size_t);
-PTR calloc (size_t, size_t);
-PTR sbrk (ptrdiff_t);
-#endif
+# if HAVE_STDLIB_H && HAVE_UNISTD_H && HAVE_DECL_MALLOC \
+ && HAVE_DECL_REALLOC && HAVE_DECL_CALLOC && HAVE_DECL_SBRK
+# include <stdlib.h>
+# include <unistd.h>
+# else
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+void *malloc (size_t);
+void *realloc (void *, size_t);
+void *calloc (size_t, size_t);
+void *sbrk (ptrdiff_t);
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
+# endif /* HAVE_STDLIB_H ... */
+#endif /* VMS */
/* The program name if set. */
static const char *name = "";