This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Remove redundant PL_lex_stuff null checks
authorFather Chrysostomos <sprout@cpan.org>
Thu, 5 Feb 2015 06:03:03 +0000 (22:03 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 5 Feb 2015 17:15:16 +0000 (09:15 -0800)
In these three code paths, PL_lex_stuff is never null, so there is no
need to check that.

toke.c

diff --git a/toke.c b/toke.c
index 3eb6bac..5373510 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7677,10 +7677,8 @@ Perl_yylex(pTHX)
            }
            if (!words)
                words = newNULLLIST();
            }
            if (!words)
                words = newNULLLIST();
-           if (PL_lex_stuff) {
-               SvREFCNT_dec(PL_lex_stuff);
-               PL_lex_stuff = NULL;
-           }
+           SvREFCNT_dec_NN(PL_lex_stuff);
+           PL_lex_stuff = NULL;
            PL_expect = XOPERATOR;
            pl_yylval.opval = sawparens(words);
            TOKEN(QWLIST);
            PL_expect = XOPERATOR;
            pl_yylval.opval = sawparens(words);
            TOKEN(QWLIST);
@@ -8995,10 +8993,8 @@ S_scan_subst(pTHX_ char *start)
     first_line = CopLINE(PL_curcop);
     s = scan_str(s,FALSE,FALSE,FALSE,NULL);
     if (!s) {
     first_line = CopLINE(PL_curcop);
     s = scan_str(s,FALSE,FALSE,FALSE,NULL);
     if (!s) {
-       if (PL_lex_stuff) {
-           SvREFCNT_dec(PL_lex_stuff);
-           PL_lex_stuff = NULL;
-       }
+       SvREFCNT_dec_NN(PL_lex_stuff);
+       PL_lex_stuff = NULL;
        Perl_croak(aTHX_ "Substitution replacement not terminated");
     }
     PL_multi_start = first_start;      /* so whole substitution is taken together */
        Perl_croak(aTHX_ "Substitution replacement not terminated");
     }
     PL_multi_start = first_start;      /* so whole substitution is taken together */
@@ -9077,10 +9073,8 @@ S_scan_trans(pTHX_ char *start)
 
     s = scan_str(s,FALSE,FALSE,FALSE,NULL);
     if (!s) {
 
     s = scan_str(s,FALSE,FALSE,FALSE,NULL);
     if (!s) {
-       if (PL_lex_stuff) {
-           SvREFCNT_dec(PL_lex_stuff);
-           PL_lex_stuff = NULL;
-       }
+       SvREFCNT_dec_NN(PL_lex_stuff);
+       PL_lex_stuff = NULL;
        Perl_croak(aTHX_ "Transliteration replacement not terminated");
     }
 
        Perl_croak(aTHX_ "Transliteration replacement not terminated");
     }