summaryrefslogtreecommitdiff
path: root/missing/alloca.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/alloca.c')
-rw-r--r--missing/alloca.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/missing/alloca.c b/missing/alloca.c
index 6879618c8a..d039dfc2cc 100644
--- a/missing/alloca.c
+++ b/missing/alloca.c
@@ -6,7 +6,7 @@
This implementation of the PWB library alloca() function,
which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
+ that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
It should work under any C implementation that uses an
@@ -29,7 +29,11 @@
static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */
#endif
-#include "config.h"
+#include "ruby/internal/config.h"
+#define X3J11 1 /* config.h should contain void if needed */
+
+#ifdef C_ALLOCA
+
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
@@ -50,9 +54,14 @@ typedef void *pointer; /* generic pointer type */
typedef char *pointer; /* generic pointer type */
#endif /* X3J11 */
+#ifndef NULL
#define NULL 0 /* null pointer constant */
+#endif
-extern void free();
+#define xmalloc ruby_xmalloc
+#define xfree ruby_xfree
+
+extern void xfree();
extern pointer xmalloc();
/*
@@ -157,7 +166,7 @@ alloca (size) /* returns pointer to storage */
{
register header *np = hp->h.next;
- free ((pointer) hp); /* collect garbage */
+ xfree ((pointer) hp); /* collect garbage */
hp = np; /* -> next header */
}
@@ -187,3 +196,4 @@ alloca (size) /* returns pointer to storage */
}
}
+#endif