This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_formline: make FF_LITERAL use item_is_utf8 flag
authorDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 11:16:23 +0000 (12:16 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 19:21:53 +0000 (20:21 +0100)
This is in preparation for merging with the FF_LINEGLOB code.
Should be no change in functionality.

pp_ctl.c

index 2f0ddcd..335e6dd 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -605,7 +605,8 @@ PP(pp_formline)
 
        case FF_LITERAL:
            arg = *fpc++;
-           if (targ_is_utf8 && !SvUTF8(formsv)) {
+           item_is_utf8 = targ_is_utf8 ? !!DO_UTF8(formsv) : !!SvUTF8(formsv);
+           if (targ_is_utf8 && !item_is_utf8) {
                char *s;
                SvCUR_set(PL_formtarget, t - SvPVX_const(PL_formtarget));
                *t = '\0';
@@ -627,7 +628,7 @@ PP(pp_formline)
                f += arg;
                break;
            }
-           if (!targ_is_utf8 && DO_UTF8(formsv)) {
+           if (!targ_is_utf8 && item_is_utf8) {
                SvCUR_set(PL_formtarget, t - SvPVX_const(PL_formtarget));
                *t = '\0';
                sv_utf8_upgrade_flags_grow(PL_formtarget, 0, fudge + 1);