* eval.c (RETURN): Wrap in do{}while(0) in order to make it
[bpt/guile.git] / libguile / alloca.c
index b36c32a..e814ed4 100644 (file)
    allocating any.  It is a good idea to use alloca(0) in
    your main control loop, etc. to force garbage collection.  */
 
+
 #ifdef HAVE_CONFIG_H
-#include <scmconfig.h>
+#include "libguile/scmconfig.h"
 #endif
 
-#define malloc(size) (scm_must_malloc ((size), "alloca emulation"))
-extern char *scm_must_malloc ();
-
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -36,7 +34,7 @@ extern char *scm_must_malloc ();
 #endif
 
 #ifdef emacs
-#include "blockinput.h"
+#include "libguile/blockinput.h"
 #endif
 
 /* If compiling with GCC 2, this file's not needed.  */
@@ -156,8 +154,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 (unsigned size)
 {
   auto char probe;             /* Probes stack depth: */
   register char *depth = ADDRESS_FUNCTION (probe);
@@ -203,11 +200,14 @@ alloca (size)
   /* Allocate combined header + user data storage.  */
 
   {
-    register pointer new = malloc (sizeof (header) + size);
+    register pointer new = (pointer) malloc (sizeof (header) + size);
     /* Address of header.  */
 
     if (new == 0)
-      abort();
+      {
+       write (2, "alloca emulation: out of memory\n", 32);
+       abort();
+      }
 
     ((header *) new)->h.next = last_alloca_header;
     ((header *) new)->h.deep = depth;
@@ -490,3 +490,9 @@ i00afunc (long address)
 
 #endif /* no alloca */
 #endif /* not GCC version 2 */
+
+/*
+  Local Variables:
+  c-file-style: "gnu"
+  End:
+*/