mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix the unnecessary mrb_str_modify() call
Now to be calls `mrb_str_modify()` only once when 2 or more characters.
This commit is contained in:
+3
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user