diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-04-21 11:42:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-04-21 11:42:43 +0000 |
commit | 4ea561bc94841f378b6950ed75b669dc60767dfa (patch) | |
tree | 7a76995aa0b9fd27756ad182df7d997dd06c953c /pp.c | |
parent | 25270bc0b7409c7dbdeef1a6ec0b548e2d3e51a1 (diff) | |
download | perl-4ea561bc94841f378b6950ed75b669dc60767dfa.tar.gz |
Where possible, use SvIV instead of SvIVX, SvNV instead of SvNVX,
SvUV instead of SvUVX, and SvPV* variants instead of SvPVX*.
Document that the non-x variants are preferable whenever the expression
has no side effects. (Compilers perform common subexression
elimination). Likewise SvREFCNT_inc simple variants are valid for all
cases apart from expressions with side effects.
p4raw-id: //depot/perl@31010
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1475,7 +1475,7 @@ PP(pp_repeat) count = (IV)nv; } else - count = SvIVx(sv); + count = SvIV(sv); if (GIMME == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) { dMARK; static const char oom_list_extend[] = "Out of memory during list extend"; @@ -3863,7 +3863,7 @@ PP(pp_aslice) register SV **svp; I32 max = -1; for (svp = MARK + 1; svp <= SP; svp++) { - const I32 elem = SvIVx(*svp); + const I32 elem = SvIV(*svp); if (elem > max) max = elem; } @@ -3872,7 +3872,7 @@ PP(pp_aslice) } while (++MARK <= SP) { register SV **svp; - I32 elem = SvIVx(*MARK); + I32 elem = SvIV(*MARK); if (elem > 0) elem -= arybase; @@ -4118,7 +4118,7 @@ PP(pp_lslice) register SV **lelem; if (GIMME != G_ARRAY) { - I32 ix = SvIVx(*lastlelem); + I32 ix = SvIV(*lastlelem); if (ix < 0) ix += max; else @@ -4137,7 +4137,7 @@ PP(pp_lslice) } for (lelem = firstlelem; lelem <= lastlelem; lelem++) { - I32 ix = SvIVx(*lelem); + I32 ix = SvIV(*lelem); if (ix < 0) ix += max; else @@ -4216,7 +4216,7 @@ PP(pp_splice) SP++; if (++MARK < SP) { - offset = i = SvIVx(*MARK); + offset = i = SvIV(*MARK); if (offset < 0) offset += AvFILLp(ary) + 1; else |