From 06a01bd00706147d4a832536a4049011c6439070 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Mon, 18 Nov 2024 22:02:09 +0000 Subject: [PATCH] Use OP_TYPE_IS_COP() in op.c and peep.c --- op.c | 10 ++++------ peep.c | 10 +++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/op.c b/op.c index c3e3d89584529..0927304aee522 100644 --- a/op.c +++ b/op.c @@ -2136,8 +2136,7 @@ Perl_scalarvoid(pTHX_ OP *arg) const char* useless = NULL; OP * next_kid = NULL; - if (o->op_type == OP_NEXTSTATE - || o->op_type == OP_DBSTATE + if (OP_TYPE_IS_COP(o) || (o->op_type == OP_NULL && (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE))) PL_curcop = (COP*)o; /* for warning below */ @@ -4516,13 +4515,12 @@ Perl_op_scope(pTHX_ OP *o) OP *kid; OpTYPE_set(o, OP_SCOPE); kid = cLISTOPo->op_first; - if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) { + if (OP_TYPE_IS_COP(kid)) { op_null(kid); /* The following deals with things like 'do {1 for 1}' */ kid = OpSIBLING(kid); - if (kid && - (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE)) + if (kid && OP_TYPE_IS_COP(kid)) op_null(kid); } } @@ -4538,7 +4536,7 @@ Perl_op_unscope(pTHX_ OP *o) if (o && o->op_type == OP_LINESEQ) { OP *kid = cLISTOPo->op_first; for(; kid; kid = OpSIBLING(kid)) - if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) + if (OP_TYPE_IS_COP(kid)) op_null(kid); } return o; diff --git a/peep.c b/peep.c index c92dc5d0ab58d..7cf2472cefb4b 100644 --- a/peep.c +++ b/peep.c @@ -1253,9 +1253,7 @@ S_finalize_op(pTHX_ OP* o) case OP_EXEC: if (OpHAS_SIBLING(o)) { OP *sib = OpSIBLING(o); - if (( sib->op_type == OP_NEXTSTATE || sib->op_type == OP_DBSTATE) - && ckWARN(WARN_EXEC) - && OpHAS_SIBLING(sib)) + if (OP_TYPE_IS_COP(sib) && ckWARN(WARN_EXEC) && OpHAS_SIBLING(sib)) { const OPCODE type = OpSIBLING(sib)->op_type; if (type != OP_EXIT && type != OP_WARN && type != OP_DIE) { @@ -3343,8 +3341,7 @@ Perl_rpeep(pTHX_ OP *o) ) { U8 old_count; assert(oldoldop->op_next == oldop); - assert( oldop->op_type == OP_NEXTSTATE - || oldop->op_type == OP_DBSTATE); + assert(OP_TYPE_IS_COP(oldop)); assert(oldop->op_next == o); old_count @@ -3379,8 +3376,7 @@ Perl_rpeep(pTHX_ OP *o) && (p->op_private & OPpLVAL_INTRO) == intro && !(p->op_private & ~OPpLVAL_INTRO) && p->op_next - && ( p->op_next->op_type == OP_NEXTSTATE - || p->op_next->op_type == OP_DBSTATE) + && OP_TYPE_IS_COP(p) && count < OPpPADRANGE_COUNTMASK && base + count == p->op_targ ) {