From 3e5129558b7e6cdb6e9683ceee689dcb13c06ca5 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 11 Jul 2025 07:53:44 +0900 Subject: [PATCH] mruby-sprintf: remove misleading comment and dead code The `XXX` comment in `sprintf.c` suggested that not validating the number of arguments for positional format specifiers was a bug. However, CRuby's `sprintf` also ignores extra arguments in this case, making the existing behavior correct. This commit removes the confusing comment and the disabled code block that went with it, clarifying the intended behavior and cleaning up the code. Co-authored-by: Gemini --- mrbgems/mruby-sprintf/src/sprintf.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c index 5d6401e3a..e083503ba 100644 --- a/mrbgems/mruby-sprintf/src/sprintf.c +++ b/mrbgems/mruby-sprintf/src/sprintf.c @@ -846,15 +846,6 @@ retry: } sprint_exit: -#if 0 - /* XXX - We cannot validate the number of arguments if (digit)$ style used. - */ - if (posarg >= 0 && nextarg < argc) { - const char *mesg = "too many arguments for format string"; - if (mrb_test(ruby_debug)) mrb_raise(mrb, E_ARGUMENT_ERROR, mesg); - if (mrb_test(ruby_verbose)) mrb_warn(mrb, mesg); - } -#endif mrb_str_resize(mrb, result, blen); return result;