@@ -1740,11 +1740,11 @@ static inline VALUE
1740
1740
ec_str_duplicate (struct rb_execution_context_struct * ec , VALUE klass , VALUE str )
1741
1741
{
1742
1742
VALUE dup ;
1743
- if (FL_TEST (str , STR_NOEMBED )) {
1744
- dup = ec_str_alloc_heap (ec , klass );
1743
+ if (STR_EMBED_P (str )) {
1744
+ dup = ec_str_alloc_embed (ec , klass , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
1745
1745
}
1746
1746
else {
1747
- dup = ec_str_alloc_embed (ec , klass , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
1747
+ dup = ec_str_alloc_heap (ec , klass );
1748
1748
}
1749
1749
1750
1750
return str_duplicate_setup (klass , str , dup );
@@ -1754,11 +1754,11 @@ static inline VALUE
1754
1754
str_duplicate (VALUE klass , VALUE str )
1755
1755
{
1756
1756
VALUE dup ;
1757
- if (FL_TEST (str , STR_NOEMBED )) {
1758
- dup = str_alloc_heap (klass );
1757
+ if (STR_EMBED_P (str )) {
1758
+ dup = str_alloc_embed (klass , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
1759
1759
}
1760
1760
else {
1761
- dup = str_alloc_embed (klass , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
1761
+ dup = str_alloc_heap (klass );
1762
1762
}
1763
1763
1764
1764
return str_duplicate_setup (klass , str , dup );
@@ -10710,11 +10710,11 @@ static VALUE
10710
10710
rb_str_b (VALUE str )
10711
10711
{
10712
10712
VALUE str2 ;
10713
- if (FL_TEST (str , STR_NOEMBED )) {
10714
- str2 = str_alloc_heap (rb_cString );
10713
+ if (STR_EMBED_P (str )) {
10714
+ str2 = str_alloc_embed (rb_cString , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
10715
10715
}
10716
10716
else {
10717
- str2 = str_alloc_embed (rb_cString , RSTRING_LEN ( str ) + TERM_LEN ( str ) );
10717
+ str2 = str_alloc_heap (rb_cString );
10718
10718
}
10719
10719
str_replace_shared_without_enc (str2 , str );
10720
10720
0 commit comments