bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] grep: do lowercase conversion in print_line_middle only for


From: Paolo Bonzini
Subject: [PATCH 1/3] grep: do lowercase conversion in print_line_middle only for single-byte case
Date: Wed, 24 Mar 2010 16:18:04 +0100

From: Norihirio Tanaka <address@hidden>

* src/main.c (print_line_middle): Restrict match_icase code
to MB_CUR_MAX == 1.  Adjust comments.
---
 src/main.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index e6be36b..b52ad47 100644
--- a/src/main.c
+++ b/src/main.c
@@ -727,13 +727,18 @@ print_line_middle (const char *beg, const char *lim,
   char *buf;           /* XXX */
   const char *ibeg;    /* XXX */
 
-  if (match_icase)     /* XXX - None of the -i stuff should be here.  */
+  /* XXX - dfasearch.c and kwsearch.c are already doing the same for
+     MB_CUR_MAX > 1.  Maybe we should do that unconditionally there
+     to avoid dealing with match_icase here.  */
+  if (match_icase
+#ifdef MBS_SUPPORT
+      && MB_CUR_MAX == 1
+#endif
+     )
     {
       int i = lim - beg;
 
       ibeg = buf = xmalloc(i);
-      /* This can't possibly be correct with UTF-8,
-        but it's equivalent to what was there so far.  */
       while (--i >= 0)
        buf[i] = tolower((unsigned char) beg[i]);
     }
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]