diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-21 21:59:20 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-21 22:15:37 -0700 |
commit | 1555b325296e46f7b95bee03fe856cec348b0d57 (patch) | |
tree | 2db4ad26522017f09145ae14ef5bf42e1701b656 /symbian/symbian_stubs.h | |
parent | ab9bd41aefd0cbe65798553f90440a85d227c64b (diff) | |
download | perl-1555b325296e46f7b95bee03fe856cec348b0d57.tar.gz |
[perl #118747] Allow in-place s///g when !!PL_sawampersand
In pp_subst, there is an initial pattern match against the target
string, followed by logic to determine which of several code paths
will handle the rest of the substitution, depending on which shortcuts
can be taken.
There is one path specifically for doing a global sort (/g) and modi-
fying the target in place. This code was skipped if the target was a
copy-on-write scalar or if the pre-match copy was enabled. The pre-
match copy is always enabled now, so this code is unreachable.
There does not appear to be any reason why this path must be skipped
in the presence of the pre-match copy. The string gets copied by the
initial regexp match and $& and friends point there afterwards.
This skip was added in commit 5d5aaa5e7 (a jumbo patch, so good luck
figuring it out). This commit removes the skip, and all tests pass.
This, of course, only affects those cases where copy-on-write does
not kick in; for instance, when the string’s length is one less than
its buffer:
$ ./perl -Ilib -e 'use Devel::Peek; $x = " "; $x .= " "x22; Dump $x; $x =~ s/ /b/g; Dump $x'
SV = PV(0x7ffb0b807098) at 0x7ffb0b82eed8
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x7ffb0b4066b8 " "\0
CUR = 23
LEN = 24
SV = PV(0x7ffb0b807098) at 0x7ffb0b82eed8
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x7ffb0b4066b8 "bbbbbbbbbbbbbbbbbbbbbbb"\0
CUR = 23
LEN = 24
Diffstat (limited to 'symbian/symbian_stubs.h')
0 files changed, 0 insertions, 0 deletions