save/restore arena index in mirb; close #740

parent 5166aa72
...@@ -159,6 +159,7 @@ main(void) ...@@ -159,6 +159,7 @@ main(void)
mrb_value result; mrb_value result;
int n; int n;
int code_block_open = FALSE; int code_block_open = FALSE;
int ai;
print_hint(); print_hint();
...@@ -172,6 +173,7 @@ main(void) ...@@ -172,6 +173,7 @@ main(void)
cxt = mrbc_context_new(mrb); cxt = mrbc_context_new(mrb);
cxt->capture_errors = 1; cxt->capture_errors = 1;
ai = mrb_gc_arena_save(mrb);
while (TRUE) { while (TRUE) {
#ifndef ENABLE_READLINE #ifndef ENABLE_READLINE
print_cmdline(code_block_open); print_cmdline(code_block_open);
...@@ -253,6 +255,7 @@ main(void) ...@@ -253,6 +255,7 @@ main(void)
ruby_code[0] = '\0'; ruby_code[0] = '\0';
last_code_line[0] = '\0'; last_code_line[0] = '\0';
mrb_parser_free(parser); mrb_parser_free(parser);
mrb_gc_arena_restore(mrb, ai);
} }
} }
mrbc_context_free(mrb, cxt); mrbc_context_free(mrb, cxt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment