summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-12-19 12:09:15 +0000
committerDavid Mitchell <davem@iabyn.com>2017-12-19 15:15:02 +0000
commitc352ee5f96ca31651e1bac4e2f72702d961e700c (patch)
treeca81913637928c3b6a49c301b8ea5469a926a673 /pp_hot.c
parent159675014fd98cba9a4bb64961c8cec02dfec87d (diff)
downloadperl-c352ee5f96ca31651e1bac4e2f72702d961e700c.tar.gz
s///: return boolean in not-in-place branch
A while back, s/// (and other ops) were optimised to return PL_sv_yes/PL_sv_zero rather than an iteration count in boolean context. This optimisation was missed in one place in pp_subst(): the 'can modify in place' branch was done, but the other branch was missed. This commit fixes that.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 100ae39b07..958aa6e40e 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -4470,7 +4470,10 @@ PP(pp_subst)
SvPV_set(dstr, NULL);
SPAGAIN;
- mPUSHi(iters);
+ if (PL_op->op_private & OPpTRUEBOOL)
+ PUSHs(iters ? &PL_sv_yes : &PL_sv_zero);
+ else
+ mPUSHi(iters);
}
}