use picrin's allocator in lexer

This commit is contained in:
Yuichi Nishiwaki 2014-02-01 19:33:38 +09:00
parent c68a7c41c7
commit 6a8a0dc8cb
1 changed files with 7 additions and 7 deletions

View File

@ -142,29 +142,29 @@ infnan "+inf.0"|"-inf.0"|"+nan.0"|"-nan.0"
%% %%
#define UNUSED(v) ((void)(v)) #undef yyextra
#define yyextra ((struct yyguts_t *)yyscanner)->yyextra_r
void * void *
yyalloc(size_t bytes, yyscan_t yyscanner) yyalloc(size_t bytes, yyscan_t yyscanner)
{ {
UNUSED(yyscanner); return pic_alloc(yyextra->pic, bytes);
return malloc(bytes);
} }
void * void *
yyrealloc(void *ptr, size_t bytes, yyscan_t yyscanner) yyrealloc(void *ptr, size_t bytes, yyscan_t yyscanner)
{ {
UNUSED(yyscanner); return pic_realloc(yyextra->pic, ptr, bytes);
return realloc(ptr, bytes);
} }
void void
yyfree(void * ptr, yyscan_t yyscanner) yyfree(void * ptr, yyscan_t yyscanner)
{ {
UNUSED(yyscanner); return pic_free(yyextra->pic, ptr);
free(ptr);
} }
#define UNUSED(v) ((void)(v))
int int
yywrap(yyscan_t yyscanner) yywrap(yyscan_t yyscanner)
{ {