diff options
author | David Mitchell <davem@iabyn.com> | 2018-03-06 15:08:23 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-03-06 15:08:23 +0000 |
commit | 490b24f64ea32c981bbd0eb40a4e029676710954 (patch) | |
tree | 6e57e47b456d16f3b21ad1b0dc4674b842fb9495 /pp.c | |
parent | 4d25b7b08aaf2671c67fde2ac79b29a97966579a (diff) | |
download | perl-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |