This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c:S_new_constant: Use NN SvREFCNT_inc in 2 places
authorFather Chrysostomos <sprout@cpan.org>
Sat, 8 Dec 2012 13:49:13 +0000 (05:49 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 9 Dec 2012 02:46:53 +0000 (18:46 -0800)
The sv argument passed to new_constant is never null.  If the function
it calls is naughty enough to push a null on the stack, new_constant’s
callers will crash anyway.  So we can assume res is not null.

This eliminates needless null checks.

toke.c

diff --git a/toke.c b/toke.c
index 8d0ce6a..0d79a5b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -9130,11 +9130,11 @@ now_ok:
        errstr = SvPV_const(errsv, errlen);
        yyerror_pvn(errstr, errlen, 0); /* Duplicates the message inside eval */
        (void)POPs;
-       res = SvREFCNT_inc_simple(sv);
+       res = SvREFCNT_inc_simple_NN(sv);
     }
     else {
        res = POPs;
-       SvREFCNT_inc_simple_void(res);
+       SvREFCNT_inc_simple_void_NN(res);
     }
 
     PUTBACK ;