1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Term fill in String#{,l,r}strip! even when SHARABLE_MIDDLE_SUBSTRING

Each of these methods calls str_modify_keep_cr before
term filling, which should ensure the backing string
uses private memory, and therefore term filling should
not affect other strings.

Skipping the term filling was added in
a707ab4bc8.

Fixes [Bug #12540]
This commit is contained in:
Jeremy Evans 2021-08-10 14:19:33 -07:00 committed by Nobuyoshi Nakada
parent a0a8f2abf5
commit 84bf4d2ce5
Notes: git 2021-08-11 13:41:17 +09:00

View file

@ -9322,9 +9322,7 @@ rb_str_lstrip_bang(VALUE str)
s = start + loffset;
memmove(start, s, len);
STR_SET_LEN(str, len);
#if !SHARABLE_MIDDLE_SUBSTRING
TERM_FILL(start+len, rb_enc_mbminlen(enc));
#endif
return str;
}
return Qnil;
@ -9411,9 +9409,7 @@ rb_str_rstrip_bang(VALUE str)
long len = olen - roffset;
STR_SET_LEN(str, len);
#if !SHARABLE_MIDDLE_SUBSTRING
TERM_FILL(start+len, rb_enc_mbminlen(enc));
#endif
return str;
}
return Qnil;
@ -9482,9 +9478,7 @@ rb_str_strip_bang(VALUE str)
memmove(start, start + loffset, len);
}
STR_SET_LEN(str, len);
#if !SHARABLE_MIDDLE_SUBSTRING
TERM_FILL(start+len, rb_enc_mbminlen(enc));
#endif
return str;
}
return Qnil;