diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-18 11:50:49 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-18 11:50:49 +0000 |
| commit | fdfd5e3a1768376428efa9fcd0046879776f063c (patch) | |
| tree | 2c90c27edbbba2415edb1817252c0fb05177a58b /string.c | |
| parent | 4f2d51cdb87dcc413934e000fa27c52e05ecf392 (diff) | |
| download | ruby-fdfd5e3a1768376428efa9fcd0046879776f063c.tar.gz ruby-fdfd5e3a1768376428efa9fcd0046879776f063c.tar.xz ruby-fdfd5e3a1768376428efa9fcd0046879776f063c.zip | |
* string.c (rb_str_dup_frozen): handle tail shared string.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |
