diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-12-27 11:41:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-12-27 11:41:10 +0000 |
commit | fa54efaecf052db2a7799ec4c2433eeb1576402e (patch) | |
tree | 3867f9cf190015546695148d265fe7b9c2ca50e0 /pp.c | |
parent | fc51b17cb579e8cdaf6e99fdeb80f92379491759 (diff) | |
download | perl-fa54efaecf052db2a7799ec4c2433eeb1576402e.tar.gz |
Merge the opcode bodies for chop/chomp and schop/schomp.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 31 |
1 files changed, 9 insertions, 22 deletions
@@ -794,7 +794,11 @@ PP(pp_trans) PP(pp_schop) { dVAR; dSP; dTARGET; - do_chomp(TARG, TOPs, FALSE); + const bool chomping = PL_op->op_type == OP_SCHOMP; + + if (chomping) + sv_setiv(TARG, 0); + do_chomp(TARG, TOPs, chomping); SETTARG; RETURN; } @@ -802,29 +806,12 @@ PP(pp_schop) PP(pp_chop) { dVAR; dSP; dMARK; dTARGET; dORIGMARK; - while (MARK < SP) - do_chomp(TARG, *++MARK, FALSE); - SP = ORIGMARK; - XPUSHTARG; - RETURN; -} + const bool chomping = PL_op->op_type == OP_CHOMP; -PP(pp_schomp) -{ - dVAR; dSP; dTARGET; - sv_setiv(TARG, 0); - do_chomp(TARG, TOPs, TRUE); - SETs(TARG); - RETURN; -} - -PP(pp_chomp) -{ - dVAR; dSP; dMARK; dTARGET; dORIGMARK; - - sv_setiv(TARG, 0); + if (chomping) + sv_setiv(TARG, 0); while (MARK < SP) - do_chomp(TARG, *++MARK, TRUE); + do_chomp(TARG, *++MARK, chomping); SP = ORIGMARK; XPUSHTARG; RETURN; |