Commit 567075aa authored by dearblue's avatar dearblue

Fix string brakes for one UTF-8 charactor

parent 5af8a977
...@@ -1700,8 +1700,8 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str) ...@@ -1700,8 +1700,8 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
mrb_int utf8_len = RSTRING_CHAR_LEN(str); mrb_int utf8_len = RSTRING_CHAR_LEN(str);
mrb_int len = RSTR_LEN(s); mrb_int len = RSTR_LEN(s);
if (utf8_len == len) goto bytes; if (utf8_len < 2) return str;
if (utf8_len > 1) { if (utf8_len < len) {
mrb_str_modify(mrb, s); mrb_str_modify(mrb, s);
p = RSTR_PTR(s); p = RSTR_PTR(s);
e = p + RSTR_LEN(s); e = p + RSTR_LEN(s);
...@@ -1711,8 +1711,6 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str) ...@@ -1711,8 +1711,6 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
p += clen; p += clen;
} }
} }
bytes:
#endif #endif
{ {
mrb_str_modify(mrb, s); mrb_str_modify(mrb, s);
......
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