2007-10-03 00:55:33 +02:00
|
|
|
--- src/grep.c
|
|
|
|
+++ src/grep.c
|
2007-05-17 11:38:38 +02:00
|
|
|
@@ -789,28 +789,10 @@ print_line_middle (const char *beg, cons
|
|
|
|
size_t match_offset;
|
|
|
|
const char *cur = beg;
|
|
|
|
const char *mid = NULL;
|
|
|
|
- char *buf; /* XXX */
|
|
|
|
- const char *ibeg; /* XXX */
|
|
|
|
-
|
|
|
|
- if (match_icase) /* XXX - None of the -i stuff should be here. */
|
|
|
|
- {
|
|
|
|
- int i = lim - beg;
|
|
|
|
-
|
|
|
|
- ibeg = buf = (char *) 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(beg[i]);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- buf = NULL;
|
|
|
|
- ibeg = beg;
|
|
|
|
- }
|
|
|
|
|
|
|
|
while ( lim > cur
|
|
|
|
- && ((match_offset = execute(ibeg, lim - beg, &match_size,
|
|
|
|
- ibeg + (cur - beg))) != (size_t) -1))
|
|
|
|
+ && ((match_offset = execute(beg, lim - beg, &match_size,
|
|
|
|
+ beg + (cur - beg))) != (size_t) -1))
|
|
|
|
{
|
|
|
|
char const *b = beg + match_offset;
|
|
|
|
|
|
|
|
@@ -854,9 +836,6 @@ print_line_middle (const char *beg, cons
|
|
|
|
cur = b + match_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (buf)
|
|
|
|
- free(buf); /* XXX */
|
|
|
|
-
|
|
|
|
if (only_matching)
|
|
|
|
cur = lim;
|
|
|
|
else if (mid)
|
2007-10-03 00:55:33 +02:00
|
|
|
--- src/search.c
|
|
|
|
+++ src/search.c
|
|
|
|
@@ -192,11 +192,19 @@ GEAcompile (char const *pattern, size_t
|
2007-05-17 11:38:38 +02:00
|
|
|
const char *sep;
|
|
|
|
size_t total = size;
|
|
|
|
char const *motif = pattern;
|
|
|
|
+ static char translate[NCHAR];
|
|
|
|
|
|
|
|
-#if 0
|
|
|
|
- if (match_icase)
|
|
|
|
- syntax_bits |= RE_ICASE;
|
|
|
|
+ if (match_icase
|
|
|
|
+#ifdef MBS_SUPPORT
|
2007-10-03 00:55:33 +02:00
|
|
|
+ && MB_CUR_MAX == 1
|
2007-05-17 11:38:38 +02:00
|
|
|
#endif
|
2007-10-03 00:55:33 +02:00
|
|
|
+ )
|
2007-05-17 11:38:38 +02:00
|
|
|
+ {
|
|
|
|
+ int i;
|
|
|
|
+ for (i = 0; i < NCHAR; i++)
|
|
|
|
+ translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
re_set_syntax (syntax_bits);
|
|
|
|
dfasyntax (syntax_bits, match_icase, eolbyte);
|
|
|
|
|
2007-10-03 00:55:33 +02:00
|
|
|
@@ -224,6 +232,12 @@ GEAcompile (char const *pattern, size_t
|
2007-05-17 11:38:38 +02:00
|
|
|
if (patterns == NULL)
|
|
|
|
error (2, errno, _("memory exhausted"));
|
|
|
|
patterns[pcount] = patterns0;
|
|
|
|
+ if (match_icase
|
|
|
|
+#ifdef MBS_SUPPORT
|
2007-10-03 00:55:33 +02:00
|
|
|
+ && MB_CUR_MAX == 1
|
2007-05-17 11:38:38 +02:00
|
|
|
+#endif
|
2007-10-03 00:55:33 +02:00
|
|
|
+ )
|
2007-05-17 11:38:38 +02:00
|
|
|
+ patterns[pcount].regexbuf.translate = translate;
|
|
|
|
|
|
|
|
if ((err = re_compile_pattern (motif, len,
|
|
|
|
&(patterns[pcount].regexbuf))) != 0)
|