summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-18 11:50:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-18 11:50:49 +0000
commitf8c8a38d30f6e23211f7ab1ca11b84d1ab85972f (patch)
tree2c90c27edbbba2415edb1817252c0fb05177a58b /string.c
parentf4b8bbb143c952e5dc6887fbf51af87d96c00d97 (diff)
* string.c (rb_str_dup_frozen): handle tail shared string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/string.c b/string.c
index 01316b9..26d1cbf 100644
--- a/string.c
+++ b/string.c
@@ -517,8 +517,11 @@ rb_str_dup_frozen(str)
VALUE str;
{
if (FL_TEST(str, ELTS_SHARED)) {
- OBJ_FREEZE(RSTRING(str)->aux.shared);
- return RSTRING(str)->aux.shared;
+ VALUE shared = RSTRING(str)->aux.shared;
+ if (RSTRING(shared)->len == RSTRING(str)->len) {
+ OBJ_FREEZE(shared);
+ return shared;
+ }
}
if (OBJ_FROZEN(str)) return str;
str = rb_str_dup(str);