This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_formline: don't do get mg on PL_formtarget
authorDavid Mitchell <davem@iabyn.com>
Sat, 28 May 2011 14:59:05 +0000 (15:59 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 19:21:53 +0000 (20:21 +0100)
Two of the three branches that upgrade PL_formtarget to utf8 (FF_LITERAL,
FF_ITEM) do get magic while doing so, while the third (FF_LINEGLOB)
doesn't. I think the first two were just co-incidental
(they started out as simple sv_utf8_upgrade() calls added by
1bd51a4ce2ce8, and probably no consideration was given as to whether to
use the _nomg variant instead).

Make the first two no longer call magic, to be consistent with
FF_LINEGLOB.

pp_ctl.c

index 271ab05..2f0ddcd 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -630,7 +630,7 @@ PP(pp_formline)
            if (!targ_is_utf8 && DO_UTF8(formsv)) {
                SvCUR_set(PL_formtarget, t - SvPVX_const(PL_formtarget));
                *t = '\0';
-               sv_utf8_upgrade_flags_grow(PL_formtarget, SV_GMAGIC, fudge + 1);
+               sv_utf8_upgrade_flags_grow(PL_formtarget, 0, fudge + 1);
                t = SvEND(PL_formtarget);
                targ_is_utf8 = TRUE;
            }
@@ -816,7 +816,7 @@ PP(pp_formline)
                    if (!targ_is_utf8) {
                        SvCUR_set(PL_formtarget, t - SvPVX_const(PL_formtarget));
                        *t = '\0';
-                       sv_utf8_upgrade_flags_grow(PL_formtarget, SV_GMAGIC,
+                       sv_utf8_upgrade_flags_grow(PL_formtarget, 0,
                                                                    fudge + 1);
                        t = SvEND(PL_formtarget);
                        targ_is_utf8 = TRUE;