29static char SCCSid[] =
"@(#)alloca.c 1.1";
32#include "ruby/internal/config.h"
43#ifndef STACK_DIRECTION
46-- must know STACK_DIRECTION at compile-time
61#define xmalloc ruby_xmalloc
62#define xfree ruby_xfree
77#ifndef STACK_DIRECTION
78#define STACK_DIRECTION 0
81#if STACK_DIRECTION != 0
83#define STACK_DIR STACK_DIRECTION
88#define STACK_DIR stack_dir
91find_stack_direction ()
93 static char *addr = NULL;
101 find_stack_direction ();
122#define ALIGN_SIZE sizeof(double)
127 char align[ALIGN_SIZE];
144static header *last_alloca_header = NULL;
151 register char *depth = &probe;
153#if STACK_DIRECTION == 0
155 find_stack_direction ();
163 for (hp = last_alloca_header; hp != NULL;)
164 if (STACK_DIR > 0 && hp->h.deep > depth
165 || STACK_DIR < 0 && hp->h.deep < depth)
167 register header *np = hp->h.next;
169 xfree ((pointer) hp);
176 last_alloca_header = hp;
185 register pointer
new =
xmalloc (
sizeof (header) + size);
188 ((header *)
new)->h.next = last_alloca_header;
189 ((header *)
new)->h.deep = depth;
191 last_alloca_header = (header *)
new;
195 return (pointer)((
char *)
new +
sizeof(header));
#define xfree
Old name of ruby_xfree.
#define xmalloc
Old name of ruby_xmalloc.