From: Steve Peters <steve@fisharerojo.org>
Date: Sat, 5 Nov 2005 14:49:11 +0000 (+0000)
Subject: Kill warnings and add a panic to pp_defined() in case the wrong op
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d9aa96a49c0aa1ba55eb980309a89c366d8f0c06;p=p5sagit%2Fp5-mst-13.2.git

Kill warnings and add a panic to pp_defined() in case the wrong op
is passed in.

p4raw-id: //depot/perl@26017
---

diff --git a/pp_hot.c b/pp_hot.c
index 7b80467..f56b7de 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -329,7 +329,7 @@ PP(pp_or)
 PP(pp_defined)
 {
     dSP;
-    register SV* sv;
+    register SV* sv = NULL;
     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;
-    }
+    } else
+        DIE(aTHX_ "panic:  Invalid op passed to dd_defined()");
 
     switch (SvTYPE(sv)) {
     case SVt_PVAV:
@@ -371,11 +372,11 @@ PP(pp_defined)
         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)