diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-03-07 18:27:28 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-03-07 18:27:44 -0800 |
commit | 4f88962189867f78c5125bb6cc858ed96bc0880b (patch) | |
tree | c26fb79fad5f19a838235922d0d49f94b4a50853 /src/searchutils.c | |
parent | bcdf8dea9955dfcc6c72058396350a137bd8e92d (diff) | |
download | grep-4f88962189867f78c5125bb6cc858ed96bc0880b.tar.gz |
grep: fix case-fold mismatches between DFA and regex
The DFA code and the regex code didn't use the same semantics for
case-folding. The regex code says that the data char d matches
the pattern char p if uc (d) == uc (p). POSIX is unclear in this
area; the simplest fix for now is to change the DFA code to agree
with the regex code. See <http://bugs.gnu.org/16919>.
* src/dfa.c (static_assert): New macro, if not already defined.
(setbit_case_fold_c): Assume MB_CUR_MAX is 1 and that case_fold
is nonzero; all callers changed.
(setbit_case_fold_c, parse_bracket_exp, lex, atom):
Case-fold like the regex code does.
(lonesome_lower): New constant.
(case_folded_counterparts): New function.
(parse_bracket_exp): Prefer plain setbit when case-folding is
not needed.
* src/dfa.h (CASE_FOLDED_BUFSIZE): New constant.
(case_folded_counterparts): New function decl.
* src/main.c (trivial_case_ignore): Case-fold like the regex code does.
(main): Try to improve comment re trivial_case_ignore.
* tests/case-fold-titlecase: Add lots more test cases.
Diffstat (limited to 'src/searchutils.c')
0 files changed, 0 insertions, 0 deletions