Skip to content

Commit

Permalink
Term fill in String#{,l,r}strip! even when SHARABLE_MIDDLE_SUBSTRING
Browse files Browse the repository at this point in the history
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
a707ab4.

Fixes [Bug #12540]
  • Loading branch information
jeremyevans authored and nobu committed Aug 11, 2021
1 parent a0a8f2a commit 84bf4d2
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions string.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 84bf4d2

Please sign in to comment.