chars: remove superfluous afterchecks

Now that mbstrncasecmp() does the right thing, there is no need any
more to verify that only a valid multibyte sequence was matched.

(See https://savannah.gnu.org/bugs/?45579 for a test case.)

Also, this will make it possible to search for invalid sequences.

(Currently it isn't possible to enter a search string with invalid
characters, but... a user might edit the search history file.  And
if pasting at the prompt is implemented, it will be trivial to enter
invalid sequences if you have a file that contains them.)
master
Benno Schulenberg 2016-08-06 10:47:22 +02:00
parent e38e2c634b
commit 85844ee6ef
1 changed files with 2 additions and 4 deletions

View File

@ -594,8 +594,7 @@ char *mbstrcasestr(const char *haystack, const char *needle)
for (; *haystack != '\0' && haystack_len >= needle_len;
haystack += move_mbright(haystack, 0), haystack_len--) {
if (mbstrncasecmp(haystack, needle, needle_len) == 0 &&
mblen(haystack, MB_CUR_MAX) > 0)
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
return (char *)haystack;
}
@ -687,8 +686,7 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
while (TRUE) {
if (rev_start_len >= needle_len &&
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
mblen(rev_start, MB_CUR_MAX) > 0)
mbstrncasecmp(rev_start, needle, needle_len) == 0)
return (char *)rev_start;
/* If we've reached the head of the haystack, we found nothing. */