From: Vincent Pit Date: Thu, 28 Aug 2008 14:28:15 +0000 (+0200) Subject: Better logic for finding oo and om in ck_entersub X-Git-Tag: v0.04~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=7f756d0f409eb87eb7900dafdb81428e4367021b Better logic for finding oo and om in ck_entersub --- diff --git a/indirect.xs b/indirect.xs index 2d02563..aa2e691 100644 --- a/indirect.xs +++ b/indirect.xs @@ -192,13 +192,15 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) { if (hint) { const char *pm, *po; SV *svm, *svo; - op = (LISTOP *) o; - while (op->op_type != OP_PUSHMARK) - op = (LISTOP *) op->op_first; - oo = op->op_sibling; - om = oo; - while (om->op_sibling) - om = om->op_sibling; + oo = o; + do { + op = (LISTOP *) oo; + if (!op->op_flags & OPf_KIDS) + goto done; + oo = op->op_first; + } while (oo->op_type != OP_PUSHMARK); + oo = oo->op_sibling; + om = op->op_last; if (om->op_type == OP_METHOD) om = cUNOPx(om)->op_first; else if (om->op_type != OP_METHOD_NAMED)