From ea81c8d0efa39a88ddc215b91372c385511ca089 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 19:02:59 +0000 Subject: [PATCH] After removing collation for [a-z] ranges in r302512, do it here too. Instead of trying to expand whole range at regcomp() stage as we do, GNU regex allocates separate ranges [start,end] set each character is checked against, so collation is possible and turned on for ranges here. When something like that will be implemented or our obsoleted regex code will be replaced to something like TRE, and in case we decide to use collation in [a-z] ranges, all changes related to r302512 can be backed out, but now we need consistency. --- gnu/usr.bin/grep/dfa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gnu/usr.bin/grep/dfa.c b/gnu/usr.bin/grep/dfa.c index faf4f0b008a1..81e8c7854ba0 100644 --- a/gnu/usr.bin/grep/dfa.c +++ b/gnu/usr.bin/grep/dfa.c @@ -2547,8 +2547,13 @@ match_mb_charset (struct dfa *d, int s, position pos, int index) wcbuf[2] = work_mbc->range_sts[i]; wcbuf[4] = work_mbc->range_ends[i]; +#ifdef __FreeBSD__ + if (wcscmp(wcbuf, wcbuf+2) >= 0 && + wcscmp(wcbuf+4, wcbuf) >= 0) +#else if (wcscoll(wcbuf, wcbuf+2) >= 0 && wcscoll(wcbuf+4, wcbuf) >= 0) +#endif goto charset_matched; }