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 a707ab4bc8a29241440f56696098efa2f7f3ff45. Fixes [Bug #12540]
This commit is contained in:
parent
a0a8f2abf5
commit
84bf4d2ce5
Notes:
git
2021-08-11 13:41:17 +09:00
6
string.c
6
string.c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user