diff options
author | Karl Williamson <khw@cpan.org> | 2016-10-17 20:16:21 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-10-17 20:29:25 -0600 |
commit | f70a2f5652ad183b5a2f30455d893099191d896d (patch) | |
tree | b4fdcc16c4b6d9c70679a7a97bedb50a530d0c0f /op.c | |
parent | b2873c1529bb5be58a32d6aa601af13f48046b58 (diff) | |
download | perl-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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]; } |