X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Falloca.c;h=d1d54475bbbf363bc7caf0a59e651da53c085b12;hb=e44c0fd283edb9ed01a7789cf58f4254f0e582fe;hp=c4db187da555e7c1eaf383fb2631670db8520ab4;hpb=968cc4b0e8a516793b5c095de542744b17df05fa;p=gnulib.git diff --git a/lib/alloca.c b/lib/alloca.c index c4db187da..d1d54475b 100644 --- a/lib/alloca.c +++ b/lib/alloca.c @@ -25,19 +25,20 @@ # include #endif +#include + #include #include #ifdef emacs # include "lisp.h" # include "blockinput.h" -# define xalloc_die() memory_full () # ifdef EMACS_FREE # undef free # define free EMACS_FREE # endif #else -# include +# define memory_full() abort () #endif /* If compiling with GCC 2, this file's not needed. */ @@ -196,25 +197,25 @@ alloca (size_t size) { /* Address of header. */ - register void *new; + register header *new; size_t combined_size = sizeof (header) + size; if (combined_size < sizeof (header)) - xalloc_die (); + memory_full (); - new = xmalloc (combined_size); + new = malloc (combined_size); - if (new == 0) - abort(); + if (! new) + memory_full (); - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; + new->h.next = last_alloca_header; + new->h.deep = depth; - last_alloca_header = (header *) new; + last_alloca_header = new; /* User storage begins just after header. */ - return (void *) ((char *) new + sizeof (header)); + return (void *) (new + 1); } }