From 6a8a0dc8cbee2a499546a143e4cdf13a952b7054 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 1 Feb 2014 19:33:38 +0900 Subject: [PATCH] use picrin's allocator in lexer --- src/scan.l | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scan.l b/src/scan.l index c246fcff..bb2115bf 100644 --- a/src/scan.l +++ b/src/scan.l @@ -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 * yyalloc(size_t bytes, yyscan_t yyscanner) { - UNUSED(yyscanner); - return malloc(bytes); + return pic_alloc(yyextra->pic, bytes); } void * yyrealloc(void *ptr, size_t bytes, yyscan_t yyscanner) { - UNUSED(yyscanner); - return realloc(ptr, bytes); + return pic_realloc(yyextra->pic, ptr, bytes); } void yyfree(void * ptr, yyscan_t yyscanner) { - UNUSED(yyscanner); - free(ptr); + return pic_free(yyextra->pic, ptr); } +#define UNUSED(v) ((void)(v)) + int yywrap(yyscan_t yyscanner) {