From b06fdb4bfa89b1818bc23d90cd4fb3c160c4da06 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 6 Jan 2024 08:30:56 +0900 Subject: [PATCH] mruby-io/file.c: reduce the scope of local variables --- mrbgems/mruby-io/src/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index 2bfef3030..4116d4777 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -120,15 +120,13 @@ mrb_file_s_unlink(mrb_state *mrb, mrb_value obj) { const mrb_value *argv; mrb_int argc, i; - char *path; mrb_get_args(mrb, "*", &argv, &argc); for (i = 0; i < argc; i++) { - const char *utf8_path; mrb_value pathv = argv[i]; mrb_ensure_string_type(mrb, pathv); - utf8_path = RSTRING_CSTR(mrb, pathv); - path = mrb_locale_from_utf8(utf8_path, -1); + const char *utf8_path = RSTRING_CSTR(mrb, pathv); + char *path = mrb_locale_from_utf8(utf8_path, -1); if (UNLINK(path) < 0) { mrb_locale_free(path); mrb_sys_fail(mrb, utf8_path);