Subject: bug#21233: closed (Re: bug#21233: [PATCH] grep: remove codes for case insensitive matching from fgrep)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 12 Aug 2015 14:53:03 +0000

Your bug report

#21233: [PATCH] grep: remove codes for case insensitive matching from fgrep

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21233: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21233
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21233: [PATCH] grep: remove codes for case insensitive matching from fgrep
From: Paul Eggert <[email-masked]>
To: Norihiro Tanaka <[email-masked]>, [email-masked]
Date: Wed, 12 Aug 2015 07:52:45 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks for that patch too.  I installed it.

Subject: [PATCH] grep: remove codes for case insensitive matching from fgrep
From: Norihiro Tanaka <[email-masked]>
To: <[email-masked]>
Date: Tue, 11 Aug 2015 20:22:26 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

No longer fgrep matcher does not do with case insensitive matching, as
case insensitive matching for fgrep uses DFA.

This patch removes codes for them from fgrep matcher.
From 9d9be6ff0190ae58ab9ab362750a1af58f37fcf6 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Mon, 10 Nov 2014 22:07:27 +0900
Subject: [PATCH] grep: remove codes for case insensitive matching from fgrep
 matcher

No longer fgrep matcher is called in case insensitive matching, so
remove them.

* src/kwsearch.c (mb_case_map_apply): Remove function.
(Fexecute): Remove now-unused code.
---
 src/kwsearch.c | 39 +--------------------------------------
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/src/kwsearch.c b/src/kwsearch.c
index 04d1b6d..5a91eb6 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -37,14 +37,10 @@ void
 Fcompile (char const *pattern, size_t size)
 {
   size_t total = size;
-  mb_len_map_t *map = NULL;
-  char const *pat = (match_icase && MB_CUR_MAX > 1
-                     ? mbtoupper (pattern, &total, &map)
-                     : pattern);
 
   kwsinit (&kwset);
 
-  char const *p = pat;
+  char const *p = pattern;
   do
     {
       size_t len;
@@ -81,26 +77,6 @@ Fcompile (char const *pattern, size_t size)
   kwsprep (kwset);
 }
 
-/* Apply the MAP (created by mbtoupper) to the uppercase-buffer-relative
-   *OFF and *LEN, converting them to be relative to the original buffer.  */
-
-static void
-mb_case_map_apply (mb_len_map_t const *map, size_t *off, size_t *len)
-{
-  if (map)
-    {
-      size_t off_incr = 0;
-      size_t len_incr = 0;
-      size_t k;
-      for (k = 0; k < *off; k++)
-        off_incr += map[k];
-      for (; k < *off + *len; k++)
-        len_incr += map[k];
-      *off += off_incr;
-      *len += len_incr;
-    }
-}
-
 size_t
 Fexecute (char const *buf, size_t size, size_t *match_size,
           char const *start_ptr)
@@ -110,18 +86,6 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
   char eol = eolbyte;
   struct kwsmatch kwsmatch;
   size_t ret_val;
-  mb_len_map_t *map = NULL;
-
-  if (MB_CUR_MAX > 1)
-    {
-      if (match_icase)
-        {
-          char *case_buf = mbtoupper (buf, &size, &map);
-          if (start_ptr)
-            start_ptr = case_buf + (start_ptr - buf);
-          buf = case_buf;
-        }
-    }
 
   for (mb_start = beg = start_ptr ? start_ptr : buf; beg <= buf + size; beg++)
     {
@@ -194,7 +158,6 @@ Fexecute (char const *buf, size_t size, size_t *match_size,
   len = end - beg;
  success_in_beg_and_len:;
   size_t off = beg - buf;
-  mb_case_map_apply (map, &off, &len);
 
   *match_size = len;
   ret_val = off;
-- 
2.4.6