summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorInaba Hiroto <inaba@st.rim.or.jp>1998-01-11 00:53:33 +0900
committerGurusamy Sarathy <gsar@cpan.org>1998-03-02 03:13:32 +0000
commitf3ea7b5ee70397733e54550d64ca43f4288e744f (patch)
treea0e574cfde47c08fdcee740bda0c7e0d76fc6e79 /doop.c
parentecca16b0cfe0c7f04ba520f2924946a13507530e (diff)
downloadperl-f3ea7b5ee70397733e54550d64ca43f4288e744f.tar.gz
[win32] still another
Subject: [PERL] tr///s bug Message-Id: <19980110155333D.inaba@st.rim.or.jp> p4raw-id: //depot/win32/perl@613
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/doop.c b/doop.c
index be3e674109..4b10dde91e 100644
--- a/doop.c
+++ b/doop.c
@@ -29,6 +29,7 @@ do_trans(SV *sv, OP *arg)
register I32 ch;
register I32 matches = 0;
register I32 squash = op->op_private & OPpTRANS_SQUASH;
+ register U8 *p;
STRLEN len;
if (SvREADONLY(sv) && !(op->op_private & OPpTRANS_COUNTONLY))
@@ -63,14 +64,16 @@ do_trans(SV *sv, OP *arg)
}
else {
d = s;
+ p = send;
while (s < send) {
if ((ch = tbl[*s]) >= 0) {
*d = ch;
- if (matches++ && squash) {
- if (d[-1] == *d)
+ matches++;
+ if (squash) {
+ if (p == d - 1 && *p == *d)
matches--;
else
- d++;
+ p = d++;
}
else
d++;