aboutsummaryrefslogtreecommitdiff
path: root/gramar.y
diff options
context:
space:
mode:
Diffstat (limited to 'gramar.y')
-rw-r--r--gramar.y13
1 files changed, 4 insertions, 9 deletions
diff --git a/gramar.y b/gramar.y
index e4ac0ea..853d486 100644
--- a/gramar.y
+++ b/gramar.y
@@ -344,10 +344,10 @@ restorerefs(void)
buffer[i] = findref(&label[i]);
}
-unsigned short *
-compile(FILE *fd, size_t sz)
+int
+compile(FILE *fd, unsigned short *mem, size_t sz)
{
- buffer = calloc(sz, sizeof(unsigned short));
+ buffer = mem;
label = calloc(sz, sizeof(struct label));
stack = calloc(sz, sizeof(struct pair));
ref = calloc(sz, sizeof(struct pair));
@@ -364,10 +364,5 @@ compile(FILE *fd, size_t sz)
free(stack);
free(label);
- if (haserrors) {
- free(buffer);
- buffer = NULL;
- }
-
- return buffer;
+ return haserrors;
}