Commit 11e09dc5 authored by dearblue's avatar dearblue

Fix the unnecessary `mrb_str_modify()` call

Now to be calls `mrb_str_modify()` only once when 2 or more characters.
parent ec03e3f5
......@@ -1710,11 +1710,13 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
str_reverse(p, p + clen - 1);
p += clen;
}
goto bytes;
}
#endif
mrb_str_modify(mrb, s);
if (RSTR_LEN(s) > 1) {
mrb_str_modify(mrb, s);
bytes:
p = RSTR_PTR(s);
e = p + RSTR_LEN(s) - 1;
str_reverse(p, e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment