summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorNorihirio Tanaka <noritnk@kcn.ne.jp>2010-03-24 16:04:32 +0100
committerPaolo Bonzini <bonzini@gnu.org>2010-03-25 13:17:07 +0100
commit20b116a6350a479d2372e037a79a4c9a2e6700bc (patch)
tree3509ee08f29797acc3e2290211f817e62e82ea01 /src/main.c
parent281bfe635874936073b3305c462626fa1b448fd6 (diff)
downloadgrep-20b116a6350a479d2372e037a79a4c9a2e6700bc.tar.gz
grep: do lowercase conversion in print_line_middle only for single-byte case
* src/main.c (print_line_middle): Restrict match_icase code to MB_CUR_MAX == 1. Adjust comments.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index e6be36bc..e5bf50f2 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]);
}