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 <gemini@google.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-07-11 07:53:44 +09:00
parent 4bb252e2ff
commit 3e5129558b
-9
View File
@@ -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;