mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user