summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-01-18 15:36:49 -0700
committerKarl Williamson <khw@cpan.org>2017-01-19 14:42:08 -0700
commitaca416674931e15d761081a4bf7403619de2f0de (patch)
treef99a7ab588f2f3353d6802ff11f562e4c29a884e /toke.c
parent8efef67cc8e7c6d4bbc57cd7a7067d1e25248eea (diff)
downloadperl-aca416674931e15d761081a4bf7403619de2f0de.tar.gz
toke.c: Avoid work if tr/a-b/foo/
A two-element range here is already fully set up, and no need to do anything.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 8409bb674b..b54b368558 100644
--- a/toke.c
+++ b/toke.c
@@ -3092,6 +3092,14 @@ S_scan_const(pTHX_ char *start)
}
}
+ /* If the range is exactly two code points long, they are
+ * already both in the output */
+ if (UNLIKELY(range_min + 1 == range_max)) {
+ goto range_done;
+ }
+
+ /* Here the range contains at least 3 code points */
+
if (has_utf8) {
/* If everything in the transliteration is below 256, we