diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-31 19:52:37 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-31 19:52:37 +0900 |
| commit | 21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b (patch) | |
| tree | 4af0aee4970608d1afdc8647c64f5ae585096c27 /src | |
| parent | 00c6022cd7c784c6161780303aa217912ffdfedb (diff) | |
| download | mruby-21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b.tar.gz mruby-21c1e2fdadc69cdb99f8e93bc605cca43ce96e8b.zip | |
shared strings should not chain
Diffstat (limited to 'src')
| -rw-r--r-- | src/string.c | 3 |
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; |
