Make Perl_sv_utf8_upgrade* respect nomg
authorDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 19:42:28 +0000 (19:42 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 21:34:43 +0000 (21:34 +0000)
One of the code paths in Perl_sv_utf8_upgrade_flags_grow() calls
SvPV_force(), regardless of whether the SV_GMAGIC flag is set or not,
which triggers an unconditional magic get.

sv.c

diff --git a/sv.c b/sv.c
index 6e8e5f3..e7a216f 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3223,7 +3223,7 @@ Perl_sv_utf8_upgrade_flags_grow(pTHX_ register SV *const sv, const I32 flags, ST
                return len;
            }
        } else {
-           (void) SvPV_force(sv,len);
+           (void) SvPV_force_flags(sv,len,flags & SV_GMAGIC);
        }
     }