From 6e44c0bc91afec3a0a16d0b93b72e131fe22179b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 13 Sep 2024 07:27:17 +0900 Subject: [PATCH] vm.c (argnum_error): merge declaration and initialization --- src/vm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/vm.c b/src/vm.c index 99b87d9ce..4f5657e2a 100644 --- a/src/vm.c +++ b/src/vm.c @@ -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); }