aboutsummaryrefslogtreecommitdiff
path: root/gramar.y
diff options
context:
space:
mode:
Diffstat (limited to 'gramar.y')
-rw-r--r--gramar.y9
1 files changed, 7 insertions, 2 deletions
diff --git a/gramar.y b/gramar.y
index 806917d..1267201 100644
--- a/gramar.y
+++ b/gramar.y
@@ -35,10 +35,10 @@ void addref(char *);
extern int yydebug;
#endif
-struct {
+struct pair {
unsigned short val;
char *label;
-} stack[0x100], ref[0x100];
+} *stack, *ref;
int sp = 0;
int rp = 0;
@@ -276,6 +276,8 @@ compile(FILE *fd, size_t sz)
{
buffer = calloc(sz, sizeof(unsigned short));
label = calloc(sz, sizeof(char *));
+ stack = calloc(sz, sizeof(struct pair));
+ ref = calloc(sz, sizeof(struct pair));
#if YYDEBUG
yydebug = 1;
@@ -284,6 +286,9 @@ compile(FILE *fd, size_t sz)
yyin = fd;
yyparse();
restorerefs();
+
+ free(ref);
+ free(stack);
free(label);
return buffer;