Doc fix.
[bpt/emacs.git] / src / alloca.c
index 7020f32..78704e5 100644 (file)
 #include <config.h>
 #endif
 
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #ifdef emacs
+#include "lisp.h"
 #include "blockinput.h"
 #endif
 
@@ -43,9 +51,7 @@
    in order to make unexec workable
    */
 #ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
+  #error "Must know STACK_DIRECTION at compile-time"
 #endif /* STACK_DIRECTION undefined */
 #endif /* static */
 #endif /* emacs */
@@ -60,13 +66,20 @@ long i00afunc ();
 #define ADDRESS_FUNCTION(arg) &(arg)
 #endif
 
+#ifdef POINTER_TYPE
+typedef POINTER_TYPE *pointer;
+#else
 #if __STDC__
 typedef void *pointer;
 #else
 typedef char *pointer;
-#endif
+#endif /*__STDC__*/
+#endif /*POINTER_TYPE*/
 
+
+#ifndef NULL
 #define        NULL    0
+#endif
 
 /* Different portions of Emacs need to call different versions of
    malloc.  The Emacs executable needs alloca to call xmalloc, because
@@ -78,8 +91,11 @@ typedef char *pointer;
 
    Callers below should use malloc.  */
 
-#ifndef emacs
+#ifdef emacs
 #define malloc xmalloc
+#ifdef EMACS_FREE
+#define free EMACS_FREE
+#endif
 #endif
 extern pointer malloc ();
 
@@ -171,7 +187,7 @@ alloca (size)
 #endif
 
   /* Reclaim garbage, defined as all alloca'd storage that
-     was allocated from deeper in the stack than currently. */
+     was allocated from deeper in the stack than currently.  */
 
   {
     register header *hp;       /* Traverses linked list.  */
@@ -209,6 +225,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;
 
@@ -338,7 +357,7 @@ struct stk_trailer
 
 #ifdef CRAY2
 /* Determine a "stack measure" for an arbitrary ADDRESS.
-   I doubt that "lint" will like this much. */
+   I doubt that "lint" will like this much.  */
 
 static long
 i00afunc (long *address)