diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-01 11:24:32 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-01 11:24:32 +0900 |
| commit | 00f3484ff7edcfd9e6f790fbc8e84595b160d3e8 (patch) | |
| tree | a165a984dea67e3c0bf752707c7e89e1052f7a3c /mrbgems | |
| parent | d7c29322b8fea584cb8940b9d216b9e11bdf94f9 (diff) | |
| parent | 755ded2ef087bc29c8223919a3e8ab95a0692de4 (diff) | |
| download | mruby-00f3484ff7edcfd9e6f790fbc8e84595b160d3e8.tar.gz mruby-00f3484ff7edcfd9e6f790fbc8e84595b160d3e8.zip | |
Merge pull request #1986 from take-cheeze/proc_macro
REnv macros.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-proc-ext/src/proc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c index 507f91d7d..8b6ee4740 100644 --- a/mrbgems/mruby-proc-ext/src/proc.c +++ b/mrbgems/mruby-proc-ext/src/proc.c @@ -17,8 +17,8 @@ mrb_proc_new_cfunc_with_env(mrb_state *mrb, mrb_func_t f, mrb_int argc, const mr p->env = e; mrb_gc_arena_restore(mrb, ai); - e->cioff = -1; - e->flags = argc; + MRB_ENV_UNSHARE_STACK(e); + MRB_ENV_STACK_LEN(e) = argc; e->stack = (mrb_value*)mrb_malloc(mrb, sizeof(mrb_value) * argc); for (i = 0; i < argc; ++i) { e->stack[i] = argv[i]; @@ -39,9 +39,9 @@ mrb_cfunc_env_get(mrb_state *mrb, mrb_int idx) if (!e) { mrb_raise(mrb, E_TYPE_ERROR, "Can't get cfunc env from cfunc Proc without REnv."); } - if (idx < 0 || e->flags <= idx) { + if (idx < 0 || MRB_ENV_STACK_LEN(e) <= idx) { mrb_raisef(mrb, E_INDEX_ERROR, "Env index out of range: %S (expected: 0 <= index < %S)", - mrb_fixnum_value(idx), mrb_fixnum_value(e->flags)); + mrb_fixnum_value(idx), mrb_fixnum_value(MRB_ENV_STACK_LEN(e))); } return e->stack[idx]; |
