Simplify the fix for bug #41530
authorFather Chrysostomos <sprout@cpan.org>
Thu, 11 Oct 2012 07:24:18 +0000 (00:24 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 12 Oct 2012 06:07:34 +0000 (23:07 -0700)
commit64534138a19b24be2454457bdf70ffb0d983b248
treef290aa95bf6601f5e2b18f5e28d6cc3706e82a56
parenta0dd190b98da5a187fe751068264c32007af3931
Simplify the fix for bug #41530

We don’t need to upgrade the target string and redo the pattern match
if the replacement is in utf8.  We can simply convert during concate-
nation, using the more recently added SV_CATUTF8 and SV_CATBYTES flags
to sv_catpvn_flags.

This should make things faster, too, as sv_catpvn_flags does not need
to allocate extra SVs or string buffers.

This happened to trigger an existing COW bug, causing test failures.
SvIsCOW and sv_force_normal_flags were being called on TARG before
get-magic.  So a magical scalar returning a COW could have that COW
modified in place.

I added a test for something I nearly broke.
pp_hot.c
sv.h
t/re/subst.t