Add macro MRB_ENV_UNSHARE_STACK instead of assigning -1 directly.

This commit is contained in:
take_cheeze
2014-04-01 01:35:40 +09:00
parent 80534b6d14
commit b38eb72d82
3 changed files with 3 additions and 2 deletions
+1
View File
@@ -21,6 +21,7 @@ struct REnv {
};
#define MRB_ENV_STACK_LEN(e) ((e)->flags)
#define MRB_ENV_UNSHARE_STACK(e) ((e)->cioff = -1)
struct RProc {
MRB_OBJECT_HEADER;
+1 -1
View File
@@ -17,7 +17,7 @@ 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;
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) {
+1 -1
View File
@@ -248,7 +248,7 @@ cipop(mrb_state *mrb)
size_t len = (size_t)MRB_ENV_STACK_LEN(e);
mrb_value *p = (mrb_value *)mrb_malloc(mrb, sizeof(mrb_value)*len);
e->cioff = -1;
MRB_ENV_UNSHARE_STACK(e);
stack_copy(p, e->stack, len);
e->stack = p;
}