vm.c (argnum_error): merge declaration and initialization

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-09-13 07:27:17 +09:00
parent 704ad87150
commit 6e44c0bc91
+2 -4
View File
@@ -1187,8 +1187,6 @@ catch_handler_find(const mrb_irep *irep, const mrb_code *pc, uint32_t filter)
static void
argnum_error(mrb_state *mrb, mrb_int num)
{
mrb_value exc;
mrb_value str;
mrb_int argc = mrb->c->ci->n;
if (argc == 15) {
@@ -1200,8 +1198,8 @@ argnum_error(mrb_state *mrb, mrb_int num)
if (argc == 0 && mrb->c->ci->nk != 0 && !mrb_hash_empty_p(mrb, mrb->c->ci->stack[1])) {
argc++;
}
str = mrb_format(mrb, "wrong number of arguments (given %i, expected %i)", argc, num);
exc = mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str);
mrb_value str = mrb_format(mrb, "wrong number of arguments (given %i, expected %i)", argc, num);
mrb_value exc = mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str);
mrb_exc_set(mrb, exc);
}