Skip to content

Commit 7537474

Browse files
committed
Use OP_TYPE_IS_COP_NN() in various *.c files
1 parent 6f2dd74 commit 7537474

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

gv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,7 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, U32 flag
504504
isGV_with_GP_on(gv);
505505

506506
if (really_sub && !CvISXSUB(has_constant) && CvSTART(has_constant)
507-
&& ( CvSTART(has_constant)->op_type == OP_NEXTSTATE
508-
|| CvSTART(has_constant)->op_type == OP_DBSTATE))
507+
&& (OP_TYPE_IS_COP_NN(CvSTART(has_constant))))
509508
PL_curcop = (COP *)CvSTART(has_constant);
510509
GvGP_set(gv, Perl_newGP(aTHX_ gv));
511510
PL_curcop = old;

op.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,8 +2136,7 @@ Perl_scalarvoid(pTHX_ OP *arg)
21362136
const char* useless = NULL;
21372137
OP * next_kid = NULL;
21382138

2139-
if (o->op_type == OP_NEXTSTATE
2140-
|| o->op_type == OP_DBSTATE
2139+
if (OP_TYPE_IS_COP_NN(o)
21412140
|| (o->op_type == OP_NULL && (o->op_targ == OP_NEXTSTATE
21422141
|| o->op_targ == OP_DBSTATE)))
21432142
PL_curcop = (COP*)o; /* for warning below */
@@ -4516,13 +4515,12 @@ Perl_op_scope(pTHX_ OP *o)
45164515
OP *kid;
45174516
OpTYPE_set(o, OP_SCOPE);
45184517
kid = cLISTOPo->op_first;
4519-
if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) {
4518+
if (OP_TYPE_IS_COP_NN(kid)) {
45204519
op_null(kid);
45214520

45224521
/* The following deals with things like 'do {1 for 1}' */
45234522
kid = OpSIBLING(kid);
4524-
if (kid &&
4525-
(kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE))
4523+
if (kid && OP_TYPE_IS_COP_NN(kid))
45264524
op_null(kid);
45274525
}
45284526
}
@@ -4538,7 +4536,7 @@ Perl_op_unscope(pTHX_ OP *o)
45384536
if (o && o->op_type == OP_LINESEQ) {
45394537
OP *kid = cLISTOPo->op_first;
45404538
for(; kid; kid = OpSIBLING(kid))
4541-
if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE)
4539+
if (OP_TYPE_IS_COP_NN(kid))
45424540
op_null(kid);
45434541
}
45444542
return o;

peep.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,9 +1253,7 @@ S_finalize_op(pTHX_ OP* o)
12531253
case OP_EXEC:
12541254
if (OpHAS_SIBLING(o)) {
12551255
OP *sib = OpSIBLING(o);
1256-
if (( sib->op_type == OP_NEXTSTATE || sib->op_type == OP_DBSTATE)
1257-
&& ckWARN(WARN_EXEC)
1258-
&& OpHAS_SIBLING(sib))
1256+
if (OP_TYPE_IS_COP_NN(sib) && ckWARN(WARN_EXEC) && OpHAS_SIBLING(sib))
12591257
{
12601258
const OPCODE type = OpSIBLING(sib)->op_type;
12611259
if (type != OP_EXIT && type != OP_WARN && type != OP_DIE) {
@@ -3343,8 +3341,7 @@ Perl_rpeep(pTHX_ OP *o)
33433341
) {
33443342
U8 old_count;
33453343
assert(oldoldop->op_next == oldop);
3346-
assert( oldop->op_type == OP_NEXTSTATE
3347-
|| oldop->op_type == OP_DBSTATE);
3344+
assert(OP_TYPE_IS_COP_NN(oldop));
33483345
assert(oldop->op_next == o);
33493346

33503347
old_count
@@ -3379,8 +3376,7 @@ Perl_rpeep(pTHX_ OP *o)
33793376
&& (p->op_private & OPpLVAL_INTRO) == intro
33803377
&& !(p->op_private & ~OPpLVAL_INTRO)
33813378
&& p->op_next
3382-
&& ( p->op_next->op_type == OP_NEXTSTATE
3383-
|| p->op_next->op_type == OP_DBSTATE)
3379+
&& OP_TYPE_IS_COP_NN(p->op_next)
33843380
&& count < OPpPADRANGE_COUNTMASK
33853381
&& base + count == p->op_targ
33863382
) {

pp_ctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac
30343034
OP * const kid1 = cUNOPo->op_first;
30353035
/* First try all the kids at this level, since that's likeliest. */
30363036
for (kid = cUNOPo->op_first; kid; kid = OpSIBLING(kid)) {
3037-
if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) {
3037+
if (OP_TYPE_IS_COP_NN(kid)) {
30383038
STRLEN kid_label_len;
30393039
U32 kid_label_flags;
30403040
const char *kid_label = CopLABEL_len_flags(kCOP,
@@ -3057,7 +3057,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac
30573057
bool first_kid_of_binary = FALSE;
30583058
if (kid == PL_lastgotoprobe)
30593059
continue;
3060-
if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) {
3060+
if (OP_TYPE_IS_COP_NN(kid)) {
30613061
if (ops == opstack)
30623062
*ops++ = kid;
30633063
else if (ops[-1] != UNENTERABLE

regexec.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8317,8 +8317,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
83178317
}
83188318

83198319
if (o->op_type != OP_STUB) {
8320-
assert( o->op_type == OP_NEXTSTATE
8321-
|| o->op_type == OP_DBSTATE
8320+
assert(OP_TYPE_IS_COP_NN(o)
83228321
|| (o->op_type == OP_NULL
83238322
&& ( o->op_targ == OP_NEXTSTATE
83248323
|| o->op_targ == OP_DBSTATE

0 commit comments

Comments
 (0)