summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authordearblue <[email protected]>2019-06-22 22:58:18 +0900
committerdearblue <[email protected]>2019-06-22 22:58:18 +0900
commit567075aab939dd262e816832195cb11594abade9 (patch)
tree2fd0f90c6ea225b56409e06d136b0f456a973b34 /src
parent5af8a9777be82838b65c5b84bb2758f5395df998 (diff)
downloadmruby-567075aab939dd262e816832195cb11594abade9.tar.gz
mruby-567075aab939dd262e816832195cb11594abade9.zip
Fix string brakes for one UTF-8 charactor
Diffstat (limited to 'src')
-rw-r--r--src/string.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/string.c b/src/string.c
index 6d01b773c..a35262eb4 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1700,8 +1700,8 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
mrb_int utf8_len = RSTRING_CHAR_LEN(str);
mrb_int len = RSTR_LEN(s);
- if (utf8_len == len) goto bytes;
- if (utf8_len > 1) {
+ if (utf8_len < 2) return str;
+ if (utf8_len < len) {
mrb_str_modify(mrb, s);
p = RSTR_PTR(s);
e = p + RSTR_LEN(s);
@@ -1711,8 +1711,6 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
p += clen;
}
}
-
- bytes:
#endif
{
mrb_str_modify(mrb, s);