This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c:op_free: Rmv dead code; simplify cop_free logic
authorFather Chrysostomos <sprout@cpan.org>
Wed, 25 Jul 2012 23:31:07 +0000 (16:31 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 25 Jul 2012 23:31:07 +0000 (16:31 -0700)
This reverts c53f1caa and cc93af5f.

See the thread starting at
http://www.nntp.perl.org/group/perl.perl5.porters/2008/04/msg135885.html

Basically, change c53f1caa made a change, but then cc93af5f undid it,
but differently.  This resulted in dead code left by c53f1caa (type is
unused after the assignment).  And in the end the code behaved exactly
the same way, so the original problem was not fixed.  I suspect this
was a B::C bug.

op.c

diff --git a/op.c b/op.c
index d5c5579..c818739 100644 (file)
--- a/op.c
+++ b/op.c
@@ -695,21 +695,17 @@ Perl_op_free(pTHX_ OP *o)
            op_free(kid);
        }
     }
+    if (type == OP_NULL)
+       type = (OPCODE)o->op_targ;
 
     Slab_to_rw(o);
 
     /* COP* is not cleared by op_clear() so that we may track line
      * numbers etc even after null() */
-    if (type == OP_NEXTSTATE || type == OP_DBSTATE
-           || (type == OP_NULL /* the COP might have been null'ed */
-               && ((OPCODE)o->op_targ == OP_NEXTSTATE
-                   || (OPCODE)o->op_targ == OP_DBSTATE))) {
+    if (type == OP_NEXTSTATE || type == OP_DBSTATE) {
        cop_free((COP*)o);
     }
 
-    if (type == OP_NULL)
-       type = (OPCODE)o->op_targ;
-
     op_clear(o);
     FreeOp(o);
 #ifdef DEBUG_LEAKING_SCALARS