This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c:cv_ckproto_len_flags: do null checks first
authorFather Chrysostomos <sprout@cpan.org>
Fri, 28 Jun 2013 07:09:02 +0000 (00:09 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 28 Jun 2013 07:09:02 +0000 (00:09 -0700)
Checking local variables for nullness is faster than calling ckWARN_d,
which involves a function call.

op.c

diff --git a/op.c b/op.c
index 7b11d1e..f966018 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6816,10 +6816,10 @@ Perl_cv_ckproto_len_flags(pTHX_ const CV *cv, const GV *gv, const char *p,
 
     PERL_ARGS_ASSERT_CV_CKPROTO_LEN_FLAGS;
 
 
     PERL_ARGS_ASSERT_CV_CKPROTO_LEN_FLAGS;
 
-    if (!ckWARN_d(WARN_PROTOTYPE))
+    if (p == NULL && cvp == NULL)
        return;
 
        return;
 
-    if (p == NULL && cvp == NULL)
+    if (!ckWARN_d(WARN_PROTOTYPE))
        return;
 
     if (p && cvp) {
        return;
 
     if (p && cvp) {