diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-16 11:46:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-05-16 11:46:37 +0900 |
| commit | 9b604abc8300d378bb32fb0e88d6f0831ed7e0d9 (patch) | |
| tree | 20664372127568e9c64a070ef9a87874958e8a9c | |
| parent | 304b52fabe1c9672adac79dcc7777b07a468b6a4 (diff) | |
| download | mruby-9b604abc8300d378bb32fb0e88d6f0831ed7e0d9.tar.gz mruby-9b604abc8300d378bb32fb0e88d6f0831ed7e0d9.zip | |
Enable `YYSTACK_USE_ALLOCA`.
It used heap allocated memory for the parser stack, but there's
possibility of parser termination by exceptions. In that case, the
parser stack memory is leaked.
We were afraid of stack consumption, but parser stack size is only 4KB,
so we don't have to worry about it (at least for the parser).
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 3ad11f406..37d4d1bf1 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -10,13 +10,7 @@ # define YYDEBUG 1 #endif #define YYERROR_VERBOSE 1 -/* - * Force yacc to use our memory management. This is a little evil because - * the macros assume that "parser_state *p" is in scope - */ -#define YYMALLOC(n) mrb_malloc(p->mrb, (n)) -#define YYFREE(o) mrb_free(p->mrb, (o)) -#define YYSTACK_USE_ALLOCA 0 +#define YYSTACK_USE_ALLOCA 1 #include <ctype.h> #include <errno.h> |
