This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Kill warnings and add a panic to pp_defined() in case the wrong op
authorSteve Peters <steve@fisharerojo.org>
Sat, 5 Nov 2005 14:49:11 +0000 (14:49 +0000)
committerSteve Peters <steve@fisharerojo.org>
Sat, 5 Nov 2005 14:49:11 +0000 (14:49 +0000)
is passed in.

p4raw-id: //depot/perl@26017

pp_hot.c

index 7b80467..f56b7de 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -329,7 +329,7 @@ PP(pp_or)
 PP(pp_defined)
 {
     dSP;
 PP(pp_defined)
 {
     dSP;
-    register SV* sv;
+    register SV* sv = NULL;
     bool defined = FALSE;
     const int op_type = PL_op->op_type;
 
     bool defined = FALSE;
     const int op_type = PL_op->op_type;
 
@@ -344,7 +344,8 @@ PP(pp_defined)
         sv = POPs;
         if (!sv || !SvANY(sv))
             RETPUSHNO;
         sv = POPs;
         if (!sv || !SvANY(sv))
             RETPUSHNO;
-    }
+    } else
+        DIE(aTHX_ "panic:  Invalid op passed to dd_defined()");
 
     switch (SvTYPE(sv)) {
     case SVt_PVAV:
 
     switch (SvTYPE(sv)) {
     case SVt_PVAV:
@@ -371,11 +372,11 @@ PP(pp_defined)
         if(op_type == OP_DOR)
             --SP;
         RETURNOP(cLOGOP->op_other);
         if(op_type == OP_DOR)
             --SP;
         RETURNOP(cLOGOP->op_other);
-    } else if (op_type == OP_DEFINED) {
-        if(defined) 
-            RETPUSHYES;
-        RETPUSHNO;
     }
     }
+    /* assuming OP_DEFINED */
+    if(defined) 
+        RETPUSHYES;
+    RETPUSHNO;
 }
 
 PP(pp_add)
 }
 
 PP(pp_add)