This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
gv_fetchpvn_flags: Simplify some warnings code
authorBrian Fraser <fraserbn@gmail.com>
Thu, 9 May 2013 23:19:33 +0000 (20:19 -0300)
committerTony Cook <tony@develop-help.com>
Wed, 11 Sep 2013 00:28:29 +0000 (10:28 +1000)
This line originally checked isLEXWARN_on and had two different code
paths depending on that -- one of which called ckWARN(), which already
checks for isLEXWARN_off, so rather than doing duplicate work, we
just call ckWARN().

gv.c

diff --git a/gv.c b/gv.c
index b0bcd76..c84e569 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -2125,8 +2125,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
                 UTF8fARG(is_utf8, name_end-nambeg, nambeg));
     gv_init_pvn(gv, stash, name, len, (add & GV_ADDMULTI)|is_utf8);
 
-    if ( isIDFIRST_lazy_if(name, is_utf8)
-                && ! (isLEXWARN_on ? ckWARN(WARN_ONCE) : (PL_dowarn & G_WARN_ON ) ) )
+    if ( isIDFIRST_lazy_if(name, is_utf8) && !ckWARN(WARN_ONCE) )
         GvMULTI_on(gv) ;
 
     /* set up magic where warranted */