summaryrefslogtreecommitdiffstats
path: root/lexer.l
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-12-18 16:52:47 +0000
committerStephen Dolan <mu@netsoc.tcd.ie>2012-12-18 16:53:51 +0000
commit04daafbde36ab696069a9df17ff85629574491c4 (patch)
tree66bff8def53de1a0f27038d880bd1306dc2ced39 /lexer.l
parent75421cbfe32ae6428fe08b6ba83f1f7ac0322c33 (diff)
Add wrappers for malloc/realloc/free. See #43.
Diffstat (limited to 'lexer.l')
-rw-r--r--lexer.l12
1 files changed, 12 insertions, 0 deletions
diff --git a/lexer.l b/lexer.l
index b09ccce4..7090de31 100644
--- a/lexer.l
+++ b/lexer.l
@@ -1,4 +1,5 @@
%{
+#include "jv_alloc.h"
#include "compile.h"
struct lexer_param;
@@ -25,6 +26,7 @@ struct lexer_param;
%}
%option noyywrap nounput noinput nodefault
+%option noyyalloc noyyrealloc noyyfree
%option reentrant
%option extra-type="int"
%option bison-bridge bison-locations
@@ -153,3 +155,13 @@ static int enter(int c, int currstate, yyscan_t yyscanner) {
yy_push_state(state, yyscanner);
return c;
}
+
+void* yyalloc(size_t sz, void* extra) {
+ return jv_mem_alloc(sz);
+}
+void* yyrealloc(void* p, size_t sz, void* extra) {
+ return jv_mem_realloc(p, sz);
+}
+void yyfree(void* p, void* extra) {
+ jv_mem_free(p);
+}