mruby-fiber (fiber_switch): reduce the scope of local variables

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-01-03 16:07:15 +09:00
parent 93bda0d27f
commit 7861422cbe
+4 -4
View File
@@ -252,8 +252,6 @@ fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mr
}
fiber_switch_context(mrb, c);
if (status == MRB_FIBER_CREATED) {
mrb_value *b, *e;
if (!c->ci->proc) {
return fiber_error(mrb, "double resume (current)");
}
@@ -267,8 +265,10 @@ fiber_switch(mrb_state *mrb, mrb_value self, mrb_int len, const mrb_value *a, mr
}
else {
mrb_stack_extend(mrb, len+2); /* for receiver and (optional) block */
b = c->stbase+1;
e = b + len;
mrb_value *b = c->stbase+1;
mrb_value *e = b + len;
while (b<e) {
*b++ = *a++;
}