X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libiberty%2Falloca.c;h=9b2e9cb12b63b494b2de76ba74ec9a04629e8202;hb=50aacf4cb70f166dfe8586465e953df262fe6340;hp=866344429df24d88bbc5f167e88987bc12da6c4d;hpb=d94aaf6631b1121b7fa5ff0e2e2398316b203c21;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libiberty/alloca.c b/libiberty/alloca.c index 866344429df..9b2e9cb12b6 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)); } }