cast MRB_ENV_STACK_LEN to (mrb_int); ref #2600

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-10-02 17:59:01 +09:00
parent 906b62d50f
commit 83992ee163
4 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -532,9 +532,9 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
struct REnv *e = (struct REnv*)obj;
if (!MRB_ENV_STACK_SHARED_P(e)) {
int i, len;
mrb_int i, len;
len = (int)MRB_ENV_STACK_LEN(e);
len = MRB_ENV_STACK_LEN(e);
for (i=0; i<len; i++) {
mrb_gc_mark_value(mrb, e->stack[i]);
}
+2 -2
View File
@@ -40,7 +40,7 @@ env_new(mrb_state *mrb, int nlocals)
struct REnv *e;
e = (struct REnv*)mrb_obj_alloc(mrb, MRB_TT_ENV, (struct RClass*)mrb->c->ci->proc->env);
MRB_ENV_STACK_LEN(e) = (unsigned int)nlocals;
MRB_SET_ENV_STACK_LEN(e, nlocals);
e->mid = mrb->c->ci->mid;
e->cioff = mrb->c->ci - mrb->c->cibase;
e->stack = mrb->c->stack;
@@ -126,7 +126,7 @@ mrb_proc_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 || (mrb_int)MRB_ENV_STACK_LEN(e) <= 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(MRB_ENV_STACK_LEN(e)));
}