summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-31 19:52:37 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-31 19:52:37 +0900
commit21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b (patch)
tree4af0aee4970608d1afdc8647c64f5ae585096c27 /src/string.c
parent00c6022cd7c784c6161780303aa217912ffdfedb (diff)
downloadmruby-21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b.tar.gz
mruby-21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b.zip
shared strings should not chain
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index dc6dcfafe..3230121a7 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1211,6 +1211,9 @@ str_subseq(mrb_state *mrb, mrb_value str, long beg, long len)
str2 = mrb_str_new_with_class(mrb, str, 0, 0);
orig = mrb_str_ptr(str);
+ while (orig->flags & MRB_STR_SHARED) {
+ orig = orig->aux.shared;
+ }
s = mrb_str_ptr(str2);
s->buf = orig->buf + beg;
s->len = len;