mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* string.c (str_replace_shared): change embedded state atomically.
[ruby-core:29953] [ruby-dev:41456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2f9d028202
commit
701c70e068
2 changed files with 6 additions and 1 deletions
2
string.c
2
string.c
|
@ -613,8 +613,8 @@ str_replace_shared(VALUE str2, VALUE str)
|
|||
STR_SET_EMBED_LEN(str2, RSTRING_LEN(str));
|
||||
}
|
||||
else {
|
||||
FL_SET(str2, STR_NOEMBED);
|
||||
str = rb_str_new_frozen(str);
|
||||
FL_SET(str2, STR_NOEMBED);
|
||||
RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
|
||||
RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
|
||||
RSTRING(str2)->as.heap.aux.shared = str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue