summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-12-27 08:09:15 +0000
committerNicholas Clark <nick@ccl4.org>2010-12-27 08:09:15 +0000
commit20cf1f79230fba6e0a6ba5053785e5fc841ee053 (patch)
tree7330536f9f84dce0512bdb4bf4fa34e36a2e756b /pp.c
parent84cad487577c98362c0e1ea18600d4ea266a4cb4 (diff)
downloadperl-20cf1f79230fba6e0a6ba5053785e5fc841ee053.tar.gz
Refactor pp_chomp to process arguments in the same order as pp_chop.
Previously list chomp worked from last to first, whilst list chop worked from first to last.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pp.c b/pp.c
index 112f4f5f95..78b03eaeaf 100644
--- a/pp.c
+++ b/pp.c
@@ -818,12 +818,13 @@ PP(pp_schomp)
PP(pp_chomp)
{
- dVAR; dSP; dMARK; dTARGET;
+ dVAR; dSP; dMARK; dTARGET; dORIGMARK;
register I32 count = 0;
- while (SP > MARK)
- count += do_chomp(POPs);
- XPUSHi(count);
+ while (MARK < SP)
+ count += do_chomp(*++MARK);
+ SP = ORIGMARK;
+ XPUSHTARG;
RETURN;
}