aboutsummaryrefslogtreecommitdiff
path: root/gramar.y
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2012-04-17 19:54:01 +0000
committerDimitri Sokolyuk <demon@dim13.org>2012-04-17 19:54:01 +0000
commit141ac15182bb444553b5761d8894edad3db78a92 (patch)
tree0773419e26aa1b42e4446163174c7ad16cff8f08 /gramar.y
parent7ef58d5107140f7a64bd92ef44369423b936b2c6 (diff)
stack and ref may be large
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;