This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mg.c: Use SvREFCNT_dec_NN
authorFather Chrysostomos <sprout@cpan.org>
Sun, 23 Dec 2012 07:24:13 +0000 (23:24 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 26 May 2013 07:18:23 +0000 (00:18 -0700)
Using SvREFCNT_dec_NN in a couple of places eliminates needless
null checks.

mg.c

diff --git a/mg.c b/mg.c
index 5f0f758..b5ff8f7 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -3181,7 +3181,7 @@ cleanup:
     /* pop any of SAVEFREESV, SAVEDESTRUCTOR_X and "save in progress" */
     PL_savestack_ix = old_ss_ix;
     if (flags & 8)
-       SvREFCNT_dec(sv);
+       SvREFCNT_dec_NN(sv);
     PL_op = myop;                      /* Apparently not needed... */
 
     PL_Sv = tSv;                       /* Restore global temporaries. */
@@ -3247,7 +3247,7 @@ S_restore_magic(pTHX_ const void *p)
            SvTEMP_off(sv);
        }
        else
-           SvREFCNT_dec(sv); /* undo the inc in S_save_magic() */
+           SvREFCNT_dec_NN(sv); /* undo the inc in S_save_magic() */
     }
 }