Remove redundant NULL checks.
authorEric Brine <ikegami@adaelis.com>
Wed, 5 Dec 2012 06:30:25 +0000 (01:30 -0500)
committerKarl Williamson <public@khwilliamson.com>
Fri, 4 Jan 2013 04:21:53 +0000 (21:21 -0700)
It's safe to pass NULLs to SvREFCNT_dec.

cop.h
perl.c
sv.h

index 8acdec8..01e83f4 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -670,8 +670,7 @@ struct block_format {
 
 #define LEAVESUB(sv)                                                   \
     STMT_START {                                                       \
-       if (sv)                                                         \
-           SvREFCNT_dec(sv);                                           \
+       SvREFCNT_dec(sv);                                               \
     } STMT_END
 
 #define POPFORMAT(cx)                                                  \
diff --git a/perl.c b/perl.c
index 0cfb73c..0e56b88 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2252,8 +2252,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
 #endif
 
     lex_start(linestr_sv, rsfp, lex_start_flags);
-    if(linestr_sv)
-       SvREFCNT_dec(linestr_sv);
+    SvREFCNT_dec(linestr_sv);
 
     PL_subname = newSVpvs("main");
 
diff --git a/sv.h b/sv.h
index f01a91c..1eb8f1f 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -284,7 +284,7 @@ to return a meaningful value, or check for NULLness, so it's smaller
 and faster.
 
 =for apidoc Am|void|SvREFCNT_dec|SV* sv
-Decrements the reference count of the given SV.
+Decrements the reference count of the given SV. I<sv> may be be NULL.
 
 =for apidoc Am|void|SvREFCNT_dec_NN|SV* sv
 Same as SvREFCNT_dec, but can only be used if you know I<sv>