summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-03-19 11:15:21 +0000
committerDavid Mitchell <davem@iabyn.com>2019-03-19 11:26:35 +0000
commit44b0aff01ba282b14dc62a1137996136282bc17a (patch)
treed52cc7d6edf53ed867a65de61aa8736433d24bbd
parent170c919fc4986a85062e9292e4cfed24771d2224 (diff)
downloadperl-44b0aff01ba282b14dc62a1137996136282bc17a.tar.gz
op_free() remove redundant !kid test
and replace with an assert. If an op has the OPf_KIDS flag, then cUNOPo->op_first must be non-null. So testing for !kid doesn't do much, especially as on the previous line we dereference it anyway.
-rw-r--r--op.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/op.c b/op.c
index afee9fcf02..95a3061202 100644
--- a/op.c
+++ b/op.c
@@ -884,9 +884,10 @@ Perl_op_free(pTHX_ OP *o)
if (o->op_flags & OPf_KIDS) {
OP *kid, *nextkid;
+ assert(cUNOPo->op_first); /* OPf_KIDS implies op_first non-null */
for (kid = cUNOPo->op_first; kid; kid = nextkid) {
nextkid = OpSIBLING(kid); /* Get before next freeing kid */
- if (!kid || kid->op_type == OP_FREED)
+ if (kid->op_type == OP_FREED)
/* During the forced freeing of ops after
compilation failure, kidops may be freed before
their parents. */