ruby-changes:67115
From: Jeremy <ko1@a...>
Date: Wed, 11 Aug 2021 13:41:17 +0900 (JST)
Subject: [ruby-changes:67115] 84bf4d2ce5 (master): Term fill in String#{, l, r}strip! even when SHARABLE_MIDDLE_SUBSTRING
https://git.ruby-lang.org/ruby.git/commit/?id=84bf4d2ce5 From 84bf4d2ce55e16a4fb51b407a8c9c79e583596b3 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 10 Aug 2021 14:19:33 -0700 Subject: 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] --- string.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/string.c b/string.c index 0575aa8..8efe117 100644 --- a/string.c +++ b/string.c @@ -9322,9 +9322,7 @@ rb_str_lstrip_bang(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L9322 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) https://github.com/ruby/ruby/blob/trunk/string.c#L9409 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) https://github.com/ruby/ruby/blob/trunk/string.c#L9478 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; -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/