X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Falloca.c;h=6ad425a4cd6cdd2224c6f0aad359da5e32f9ec61;hb=4c692979e6e60bc1fdb6a6ef5ae3f8b2e9600fc3;hp=b102eb11bfec0613521a05828b80f0bdb31ba781;hpb=cf42d3e5e80be6bf7093a3ca9be0d04033eaf527;p=gnulib.git diff --git a/lib/alloca.c b/lib/alloca.c index b102eb11b..6ad425a4c 100644 --- a/lib/alloca.c +++ b/lib/alloca.c @@ -25,6 +25,13 @@ # include #endif +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif + #ifdef emacs # include "blockinput.h" #endif @@ -81,6 +88,7 @@ typedef char *pointer; Callers below should use malloc. */ # ifndef emacs +# undef malloc # define malloc xmalloc # endif extern pointer malloc (); @@ -161,7 +169,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ implementations of C, for example under Gould's UTX/32. */ pointer -alloca (unsigned size) +alloca (size_t size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); @@ -210,6 +218,9 @@ alloca (unsigned size) register pointer new = malloc (sizeof (header) + size); /* Address of header. */ + if (new == 0) + abort(); + ((header *) new)->h.next = last_alloca_header; ((header *) new)->h.deep = depth;