Use STR_EMBED_P instead of testing STR_NOEMBED
This commit is contained in:
parent
9b373fb428
commit
837c12b0c8
18
string.c
18
string.c
@ -1740,11 +1740,11 @@ static inline VALUE
|
|||||||
ec_str_duplicate(struct rb_execution_context_struct *ec, VALUE klass, VALUE str)
|
ec_str_duplicate(struct rb_execution_context_struct *ec, VALUE klass, VALUE str)
|
||||||
{
|
{
|
||||||
VALUE dup;
|
VALUE dup;
|
||||||
if (FL_TEST(str, STR_NOEMBED)) {
|
if (STR_EMBED_P(str)) {
|
||||||
dup = ec_str_alloc_heap(ec, klass);
|
dup = ec_str_alloc_embed(ec, klass, RSTRING_LEN(str) + TERM_LEN(str));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dup = ec_str_alloc_embed(ec, klass, RSTRING_LEN(str) + TERM_LEN(str));
|
dup = ec_str_alloc_heap(ec, klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_duplicate_setup(klass, str, dup);
|
return str_duplicate_setup(klass, str, dup);
|
||||||
@ -1754,11 +1754,11 @@ static inline VALUE
|
|||||||
str_duplicate(VALUE klass, VALUE str)
|
str_duplicate(VALUE klass, VALUE str)
|
||||||
{
|
{
|
||||||
VALUE dup;
|
VALUE dup;
|
||||||
if (FL_TEST(str, STR_NOEMBED)) {
|
if (STR_EMBED_P(str)) {
|
||||||
dup = str_alloc_heap(klass);
|
dup = str_alloc_embed(klass, RSTRING_LEN(str) + TERM_LEN(str));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dup = str_alloc_embed(klass, RSTRING_LEN(str) + TERM_LEN(str));
|
dup = str_alloc_heap(klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_duplicate_setup(klass, str, dup);
|
return str_duplicate_setup(klass, str, dup);
|
||||||
@ -10710,11 +10710,11 @@ static VALUE
|
|||||||
rb_str_b(VALUE str)
|
rb_str_b(VALUE str)
|
||||||
{
|
{
|
||||||
VALUE str2;
|
VALUE str2;
|
||||||
if (FL_TEST(str, STR_NOEMBED)) {
|
if (STR_EMBED_P(str)) {
|
||||||
str2 = str_alloc_heap(rb_cString);
|
str2 = str_alloc_embed(rb_cString, RSTRING_LEN(str) + TERM_LEN(str));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str2 = str_alloc_embed(rb_cString, RSTRING_LEN(str) + TERM_LEN(str));
|
str2 = str_alloc_heap(rb_cString);
|
||||||
}
|
}
|
||||||
str_replace_shared_without_enc(str2, str);
|
str_replace_shared_without_enc(str2, str);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user