summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-07-08 15:47:23 +0100
committerDavid Mitchell <davem@iabyn.com>2017-07-27 11:30:22 +0100
commitf4c975aa030b7ad74a7efda242fb8b771ea41c14 (patch)
tree44c906576016c351aed4443e10c27898833fbb68 /pp_ctl.c
parent775f2c0793edf33325b9ef09b476245658cfd66b (diff)
downloadperl-f4c975aa030b7ad74a7efda242fb8b771ea41c14.tar.gz
make callers of SvTRUE() more efficient
Where its obvious that the args can't be null, use SvTRUE_NN() instead. Avoid possible multiple evaluations of the arg by assigning to a local var first if necessary.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index b2624d6809..f91bb4dd38 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1128,9 +1128,11 @@ PP(pp_mapwhile)
PP(pp_range)
{
+ dTARG;
if (GIMME_V == G_ARRAY)
return NORMAL;
- if (SvTRUEx(PAD_SV(PL_op->op_targ)))
+ GETTARGET;
+ if (SvTRUE_NN(targ))
return cLOGOP->op_other;
else
return NORMAL;
@@ -1158,7 +1160,7 @@ PP(pp_flip)
flip = SvIV(sv) == SvIV(GvSV(gv));
}
} else {
- flip = SvTRUE(sv);
+ flip = SvTRUE_NN(sv);
}
if (flip) {
sv_setiv(PAD_SV(cUNOP->op_first->op_targ), 1);
@@ -1271,7 +1273,7 @@ PP(pp_flop)
}
}
else {
- flop = SvTRUE(sv);
+ flop = SvTRUE_NN(sv);
}
if (flop) {
@@ -1803,7 +1805,7 @@ Perl_die_unwind(pTHX_ SV *msv)
PP(pp_xor)
{
dSP; dPOPTOPssrl;
- if (SvTRUE(left) != SvTRUE(right))
+ if (SvTRUE_NN(left) != SvTRUE_NN(right))
RETSETYES;
else
RETSETNO;
@@ -4462,7 +4464,7 @@ PP(pp_leaveeval)
/* did require return a false value? */
failed = CxOLD_OP_TYPE(cx) == OP_REQUIRE
&& !(gimme == G_SCALAR
- ? SvTRUE(*PL_stack_sp)
+ ? SvTRUE_NN(*PL_stack_sp)
: PL_stack_sp > oldsp);
if (gimme == G_VOID) {