Skip to content
Browse files

MFC r253810

grep -i does not work for simple patterns and single byte locales, like
	LANG=ru_RU.KOI8-R grep -i <some single KOI8-R letter>
Fix it.

Approved by:    re (delphij,kib)
  • Loading branch information...
1 parent 3e7e7d4 commit 9f9ac8a8c6ad63bc03ba418df06680f502405844 ache committed Aug 2, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 usr.bin/grep/regex/tre-fastmatch.c
View
4 usr.bin/grep/regex/tre-fastmatch.c
@@ -395,7 +395,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data,
if (p == NULL) \
return REG_ESPACE; \
for (unsigned int i = 0; i < plen; i++) \
- p[i] = tolower(pat[i]); \
+ p[i] = tolower((unsigned char)pat[i]); \
_CALC_BMGS(arr, p, plen); \
xfree(p); \
} \
@@ -1030,7 +1030,7 @@ fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type)
continue;
/* Compare */
- if (fg->icase ? (tolower(pat_byte[i]) == tolower(str_byte[i]))
+ if (fg->icase ? (tolower((unsigned char)pat_byte[i]) == tolower((unsigned char)str_byte[i]))
: (pat_byte[i] == str_byte[i]))
continue;
}

0 comments on commit 9f9ac8a

Please sign in to comment.
Something went wrong with that request. Please try again.