aboutsummaryrefslogtreecommitdiff
path: root/libiberty/alloca.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-05-24 21:01:33 +0000
committerDJ Delorie <dj@redhat.com>2005-05-24 21:01:33 +0000
commitabf6a75b428517d9caaf9155212b0b10e0379a99 (patch)
tree3476694dba1d2c731deb2a131b0d8d6c5dcb0cd3 /libiberty/alloca.c
parentf127898a4db12540b9898e25777c6c3725d119bf (diff)
downloadgdb-abf6a75b428517d9caaf9155212b0b10e0379a99.zip
gdb-abf6a75b428517d9caaf9155212b0b10e0379a99.tar.gz
gdb-abf6a75b428517d9caaf9155212b0b10e0379a99.tar.bz2
merge from gcc
Diffstat (limited to 'libiberty/alloca.c')
-rw-r--r--libiberty/alloca.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libiberty/alloca.c b/libiberty/alloca.c
index 8663444..9b2e9cb 100644
--- a/libiberty/alloca.c
+++ b/libiberty/alloca.c
@@ -57,9 +57,15 @@ the possibility of a GCC built-in function.
/* These variables are used by the ASTRDUP implementation that relies
on C_alloca. */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
const char *libiberty_optr;
char *libiberty_nptr;
unsigned long libiberty_len;
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
@@ -191,20 +197,20 @@ C_alloca (size_t size)
/* Allocate combined header + user data storage. */
{
- register PTR new = xmalloc (sizeof (header) + size);
+ register void *new_storage = XNEWVEC (char, sizeof (header) + size);
/* Address of header. */
- if (new == 0)
+ if (new_storage == 0)
abort();
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
+ ((header *) new_storage)->h.next = last_alloca_header;
+ ((header *) new_storage)->h.deep = depth;
- last_alloca_header = (header *) new;
+ last_alloca_header = (header *) new_storage;
/* User storage begins just after header. */
- return (PTR) ((char *) new + sizeof (header));
+ return (PTR) ((char *) new_storage + sizeof (header));
}
}