summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2018-03-06 15:08:23 +0000
committerDavid Mitchell <davem@iabyn.com>2018-03-06 15:08:23 +0000
commit490b24f64ea32c981bbd0eb40a4e029676710954 (patch)
tree6e57e47b456d16f3b21ad1b0dc4674b842fb9495 /pp.c
parent4d25b7b08aaf2671c67fde2ac79b29a97966579a (diff)
downloadperl-490b24f64ea32c981bbd0eb40a4e029676710954.tar.gz
pp_repeat: avoid calling GIMME_V twice
assign its value to a local var instead. GIMME_V can have a considerable overhead when called in unknown context. I audited the rest of the pp*.c files, but didn't find any similar multiple calls.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 4c0a5b34b7..9a9ad3e1f8 100644
--- a/pp.c
+++ b/pp.c
@@ -1671,8 +1671,9 @@ PP(pp_repeat)
IV count;
SV *sv;
bool infnan = FALSE;
+ const U8 gimme = GIMME_V;
- if (GIMME_V == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) {
+ if (gimme == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) {
/* TODO: think of some way of doing list-repeat overloading ??? */
sv = POPs;
SvGETMAGIC(sv);
@@ -1736,7 +1737,7 @@ PP(pp_repeat)
"Negative repeat count does nothing");
}
- if (GIMME_V == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) {
+ if (gimme == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) {
dMARK;
const SSize_t items = SP - MARK;
const U8 mod = PL_op->op_flags & OPf_MOD;