This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
gv.c: For ‘Global symbol’ msg, don’t check utf8ness twice
authorFather Chrysostomos <sprout@cpan.org>
Fri, 19 Sep 2014 06:02:52 +0000 (23:02 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 19 Sep 2014 06:23:03 +0000 (23:23 -0700)
We already take care of possible utf8ness in the format string.  There
is no need to turn on the flag afterwards.  This double utf8 check has
been present since ecad31f018.

gv.c

diff --git a/gv.c b/gv.c
index 4930c03..73fb7da 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1731,7 +1731,8 @@ S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len,
 
     if (!*stash) {
         if (add && !PL_in_clean_all) {
-            SV * const err = Perl_mess(aTHX_
+            GV *gv;
+            qerror(Perl_mess(aTHX_
                  "Global symbol \"%s%"UTF8f
                  "\" requires explicit package name (did you forget to "
                  "declare \"my %s%"UTF8f"\"?)",
@@ -1742,11 +1743,7 @@ S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len,
                  (sv_type == SVt_PV ? "$"
                   : sv_type == SVt_PVAV ? "@"
                   : sv_type == SVt_PVHV ? "%"
-                  : ""), UTF8fARG(is_utf8, len, name));
-            GV *gv;
-            if (is_utf8)
-                SvUTF8_on(err);
-            qerror(err);
+                  : ""), UTF8fARG(is_utf8, len, name)));
             /* To maintain the output of errors after the strict exception
              * above, and to keep compat with older releases, rather than
              * placing the variables in the pad, we place