summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-10-17 20:16:21 -0600
committerKarl Williamson <khw@cpan.org>2016-10-17 20:29:25 -0600
commitf70a2f5652ad183b5a2f30455d893099191d896d (patch)
treeb4fdcc16c4b6d9c70679a7a97bedb50a530d0c0f /op.c
parentb2873c1529bb5be58a32d6aa601af13f48046b58 (diff)
downloadperl-f70a2f5652ad183b5a2f30455d893099191d896d.tar.gz
op.c: Fix EBCDIC-only bug
We have no tests that this fails for, but on an EBCDIC machine, the branches here are incorrect. They are trying to determine if a UTF-8 representation will be larger than a non-UTF-8 representation for code points < 256. The proper test is if the code points are UTF-8 invariant.
Diffstat (limited to 'op.c')
-rw-r--r--op.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/op.c b/op.c
index 1866632594..34c9a60d07 100644
--- a/op.c
+++ b/op.c
@@ -5426,7 +5426,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
tbl[i] = (short)i;
}
else {
- if (i < 128 && r[j] >= 128)
+ if (UVCHR_IS_INVARIANT(i) && ! UVCHR_IS_INVARIANT(r[j]))
grows = 1;
tbl[i] = r[j++];
}
@@ -5473,7 +5473,8 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
--j;
}
if (tbl[t[i]] == -1) {
- if (t[i] < 128 && r[j] >= 128)
+ if ( UVCHR_IS_INVARIANT(t[i])
+ && ! UVCHR_IS_INVARIANT(r[j]))
grows = 1;
tbl[t[i]] = r[j];
}