bug-grep
[Top][All Lists]
Advanced

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

[PATCH v2 1/4] grep: do lowercase conversion in print_line_middle only f


From: Paolo Bonzini
Subject: [PATCH v2 1/4] grep: do lowercase conversion in print_line_middle only for single-byte case
Date: Thu, 25 Mar 2010 10:42:44 +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 |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/main.c b/src/main.c
index e6be36b..e5bf50f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -724,16 +724,20 @@ print_line_middle (const char *beg, const char *lim,
   size_t match_offset;
   const char *cur = beg;
   const char *mid = NULL;
-  char *buf;           /* XXX */
-  const char *ibeg;    /* XXX */
+  char *buf;
+  const char *ibeg;
 
-  if (match_icase)     /* XXX - None of the -i stuff should be here.  */
+  /* XXX - should not be needed anymore now that we use RE_ICASE.
+     Revisit after 2.6.x stabilizes.  */
+  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]