summaryrefslogtreecommitdiff
path: root/lib/alloca.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-01-16 12:35:49 +0000
committerJim Meyering <jim@meyering.net>2000-01-16 12:35:49 +0000
commit5fae922babd5ebd5e0725403b8a82426f0ca2539 (patch)
tree3fb7a1aecb70054b6be13cecf21b4804a85f2684 /lib/alloca.c
parent840aee01de3071845eb54921c8d11e147b06ebf6 (diff)
downloadcoreutils-5fae922babd5ebd5e0725403b8a82426f0ca2539.tar.xz
Sync with the version from emacs-20.5.
(<string.h>): Include if HAVE_STRING_H. (<stdlib.h>): Include if HAVE_STDLIB_H. (alloca): Abort if malloc fails.
Diffstat (limited to 'lib/alloca.c')
-rw-r--r--lib/alloca.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/alloca.c b/lib/alloca.c
index b102eb11b..55a80677f 100644
--- a/lib/alloca.c
+++ b/lib/alloca.c
@@ -25,6 +25,13 @@
# include <config.h>
#endif
+#if HAVE_STRING_H
+# include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
#ifdef emacs
# include "blockinput.h"
#endif
@@ -210,6 +217,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;