зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
f4b8bbb143
Коммит
f8c8a38d30
|
@ -1,8 +1,10 @@
|
|||
Wed Dec 18 02:27:34 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
Wed Dec 18 03:52:55 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* string.c (rb_str_new4): handle tail shared string.
|
||||
(ruby-bugs-ja:PR#370)
|
||||
|
||||
* string.c (rb_str_dup_frozen): ditto.
|
||||
|
||||
Tue Dec 17 21:08:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* node.h (NODE_ATTRASGN): new node, assignment to attribute.
|
||||
|
|
7
string.c
7
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче