diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-18 16:52:47 +0000 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-18 16:53:51 +0000 |
commit | 04daafbde36ab696069a9df17ff85629574491c4 (patch) | |
tree | 66bff8def53de1a0f27038d880bd1306dc2ced39 /lexer.l | |
parent | 75421cbfe32ae6428fe08b6ba83f1f7ac0322c33 (diff) |
Add wrappers for malloc/realloc/free. See #43.
Diffstat (limited to 'lexer.l')
-rw-r--r-- | lexer.l | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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); +} |