diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-29 22:05:06 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-29 22:05:06 +0900 |
| commit | b20388c004c11b338ee2b6e41d3b3dd641842162 (patch) | |
| tree | 18deb908ca276a90eec0f9d07b9f2193cd0cf8a8 /src | |
| parent | 23308d55b1c3a7f77cf7b9bf789037756c1df689 (diff) | |
| download | mruby-b20388c004c11b338ee2b6e41d3b3dd641842162.tar.gz mruby-b20388c004c11b338ee2b6e41d3b3dd641842162.zip | |
make arena_idx restoration per irep, not per load
Diffstat (limited to 'src')
| -rw-r--r-- | src/load.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/load.c b/src/load.c index f2aff8cbe..e73f09b3a 100644 --- a/src/load.c +++ b/src/load.c @@ -337,6 +337,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 mrb_int fix_num; mrb_float f; mrb_value str; + int ai = mrb_gc_arena_save(mrb); recordStart = src; buf = mrb_malloc(mrb, bufsize); @@ -489,6 +490,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 *len = src - recordStart; error_exit: + mrb_gc_arena_restore(mrb, ai); if (buf) mrb_free(mrb, buf); @@ -502,7 +504,6 @@ mrb_read_irep(mrb_state *mrb, const char *bin) uint32_t len = 0; unsigned char *src; rite_binary_header bin_header; - int ai = mrb_gc_arena_save(mrb); if ((mrb == NULL) || (bin == NULL)) { return MRB_DUMP_INVALID_ARGUMENT; @@ -539,7 +540,6 @@ mrb_read_irep(mrb_state *mrb, const char *bin) mrb->irep_len += nirep; error_exit: - mrb_gc_arena_restore(mrb, ai); if (ret != MRB_DUMP_OK) { for (n=0,i=sirep; n<nirep; n++,i++) { if (mrb->irep[i]) { |
