summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/string.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/string.c b/src/string.c
index b980ee760..c8a9e61ec 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1719,12 +1719,15 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
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);
+ goto bytes;
}
return str;
+
+ bytes:
+ p = RSTR_PTR(s);
+ e = p + RSTR_LEN(s) - 1;
+ str_reverse(p, e);
+ return str;
}
/* ---------------------------------- */