string.c: avoid a local variable.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-04-14 10:55:00 +09:00
parent 15af07562a
commit eba74c038e
+1 -2
View File
@@ -1984,10 +1984,9 @@ mrb_str_rindex(mrb_state *mrb, mrb_value str)
{
mrb_value sub;
mrb_int pos;
int argc = mrb_get_args(mrb, "S|i", &sub, &pos);
mrb_int len = RSTRING_CHAR_LEN(str);
if (argc == 1) {
if (mrb_get_args(mrb, "S|i", &sub, &pos) == 1) {
pos = len;
}
else {