summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorihiro Tanaka <noritnk@kcn.ne.jp>2020-10-08 18:46:32 +0900
committerPaul Eggert <eggert@cs.ucla.edu>2020-10-11 09:53:56 -0700
commit0c64ce796dfec048499d1ad82d88f97ab09a0292 (patch)
treed339582c574c275cf55bfaf597e67c9d84e8ac14
parentb3ebcf6fa928c5801e8d13e6dd01b029771ac40a (diff)
downloadgrep-0c64ce796dfec048499d1ad82d88f97ab09a0292.tar.gz
grep: remove unused code
* src/kwsearch.c (Fcompile, Fexecute): Remove unused code. No longer these are used after commit 016e590a8198009bce0e1078f6d4c7e037e2df3c.
-rw-r--r--src/kwsearch.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 1174dbcc..1b319172 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -89,38 +89,6 @@ Fcompile (char *pattern, size_t size, reg_syntax_t ignored, bool exact)
free (buf);
ptrdiff_t words = kwswords (kwset);
- if (match_icase)
- {
- /* For each pattern character C that has a case folded
- counterpart F that is multibyte and so cannot easily be
- implemented via translating a single byte, append a pattern
- containing just F. That way, if the data contains F, the
- matcher can fall back on DFA. For example, if C is 'i' and
- the locale is en_US.utf8, append a pattern containing just
- the character U+0131 (LATIN SMALL LETTER DOTLESS I), so that
- Fexecute will use a DFA if the data contain U+0131. */
- mbstate_t mbs = { 0 };
- char checked[NCHAR] = {0,};
- for (p = pattern; p < pattern + size; p++)
- {
- unsigned char c = *p;
- if (checked[c])
- continue;
- checked[c] = true;
-
- wint_t wc = localeinfo.sbctowc[c];
- wchar_t folded[CASE_FOLDED_BUFSIZE];
-
- for (int i = case_folded_counterparts (wc, folded); 0 <= --i; )
- {
- char s[MB_LEN_MAX];
- int nbytes = wcrtomb (s, folded[i], &mbs);
- if (1 < nbytes)
- kwsincr (kwset, s, nbytes);
- }
- }
- }
-
kwsprep (kwset);
struct kwsearch *kwsearch = xmalloc (sizeof *kwsearch);
@@ -168,21 +136,6 @@ Fexecute (void *vcp, char const *buf, size_t size, size_t *match_size,
break;
len = kwsmatch.size[0] - 2 * match_lines;
- if (kwsearch->words <= kwsmatch.index)
- {
- /* The data contain a multibyte character that matches
- some pattern character that is a case folded counterpart.
- Since the kwset code cannot handle this case, fall back
- on the DFA code, which can. */
- if (! kwsearch->re)
- {
- fgrep_to_grep_pattern (&kwsearch->pattern, &kwsearch->size);
- kwsearch->re = GEAcompile (kwsearch->pattern, kwsearch->size,
- RE_SYNTAX_GREP, !!start_ptr);
- }
- return EGexecute (kwsearch->re, buf, size, match_size, start_ptr);
- }
-
mbclen = 0;
if (mb_check
&& mb_goback (&mb_start, &mbclen, beg + offset, buf + size) != 0)