X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Falloca.c;h=6ad425a4cd6cdd2224c6f0aad359da5e32f9ec61;hb=3a9db4f7ace0008d193cb2fc21a75fff109cb8fc;hp=10e5d65f01945193ae63b532c60a39278654c514;hpb=f629cb35ff2a467084745d8e635e41eb1f39f6d8;p=gnulib.git diff --git a/lib/alloca.c b/lib/alloca.c index 10e5d65f0..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,8 +169,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ implementations of C, for example under Gould's UTX/32. */ pointer -alloca (size) - unsigned size; +alloca (size_t size) { auto char probe; /* Probes stack depth: */ register char *depth = ADDRESS_FUNCTION (probe); @@ -211,6 +218,9 @@ alloca (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;