assert() that we can't reach two unreachable code paths
Nicholas Clark [Sat, 11 Feb 2006 00:40:04 +0000 (00:40 +0000)]
(in Perl_magic_get and Perl_pp_shift).

p4raw-id: //depot/perl@27154

mg.c
pp.c

diff --git a/mg.c b/mg.c
index 6446b2c..339a6d4 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -843,8 +843,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
            {
                i = t1 - s1;
                s = rx->subbeg + s1;
-               if (!rx->subbeg)
-                   break;
+               assert(rx->subbeg);
 
              getrx:
                if (i >= 0) {
diff --git a/pp.c b/pp.c
index d5c2679..3aaad3b 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -4166,8 +4166,7 @@ PP(pp_shift)
     AV * const av = (AV*)POPs;
     SV * const sv = PL_op->op_type == OP_SHIFT ? av_shift(av) : av_pop(av);
     EXTEND(SP, 1);
-    if (!sv)
-       RETPUSHUNDEF;
+    assert (sv);
     if (AvREAL(av))
        (void)sv_2mortal(sv);
     PUSHs(sv);