diff options
author | Norihiro Tanaka <noritnk@kcn.ne.jp> | 2015-10-13 09:19:10 +0900 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-10-16 22:42:06 -0700 |
commit | 468d5217ed6ec1679512dec208c7f30fb8612957 (patch) | |
tree | 79d70c5bf60a8b89c5310140c1949d056e8877e6 /src | |
parent | 805811db0ab57e37dda30f95be2927d6f7a7eba7 (diff) | |
download | grep-468d5217ed6ec1679512dec208c7f30fb8612957.tar.gz |
grep: use grep matcher for grep -Fw when unibyte
In single byte locales with grep -Fw, prefer the grep matcher to the
kwset matcher, as the former uses KWset and a DFA, whereas the latter
calls kwsexec many times until it matches a word.
* src/grep.c (main): Change pattern for fgrep into grep for grep -Fw in
single byte locales.
Diffstat (limited to 'src')
-rw-r--r-- | src/grep.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2563,9 +2563,12 @@ main (int argc, char **argv) /* If fgrep in a multibyte locale, then use grep if either (1) case is ignored (where grep is typically faster), or - (2) the pattern has an encoding error (where fgrep might not work). */ - if (compile == Fcompile && MB_CUR_MAX > 1 - && (match_icase || contains_encoding_error (keys, keycc))) + (2) the pattern matches words (where grep is typically faster), or + (3) the pattern has an encoding error (where fgrep might not work). */ + if (compile == Fcompile + && (MB_CUR_MAX > 1 && (match_icase + || contains_encoding_error (keys, keycc))) + || (MB_CUR_MAX == 1 && match_words)) { size_t new_keycc; char *new_keys; |