summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-07-15 22:06:49 -0600
committerKarl Williamson <khw@cpan.org>2016-07-16 17:42:39 -0600
commitd555b9dd665a725cb821a516235ceaa30169c3e6 (patch)
tree6fb4f46050a7e90718d2a097085fbcc612efb351 /regcomp.c
parent72e868c8f167ec109319c7c8e60e236e34bd786f (diff)
downloadperl-d555b9dd665a725cb821a516235ceaa30169c3e6.tar.gz
regcomp.c: Improve -Dr output
This improves the output of a bracketed character class under /d that has things that match only if not in utf8.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/regcomp.c b/regcomp.c
index 463f8bd0f5..2003d3d443 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -20157,10 +20157,13 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
_invlist_invert(only_utf8);
_invlist_intersection(only_utf8, PL_UpperLatin1, &only_utf8);
}
+ else if (not_utf8) {
- if (not_utf8) {
- _invlist_invert(not_utf8);
- _invlist_intersection(not_utf8, PL_UpperLatin1, &not_utf8);
+ /* If a code point matches iff the target string is not in UTF-8,
+ * then complementing the result has it not match iff not in UTF-8,
+ * which is the same thing as matching iff it is UTF-8. */
+ only_utf8 = not_utf8;
+ not_utf8 = NULL;
}
if (only_utf8_locale) {