tweaks: elide two unneeded variables
parent
067b0a3367
commit
1e2833e07b
33
src/chars.c
33
src/chars.c
|
@ -667,7 +667,6 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (use_utf8) {
|
if (use_utf8) {
|
||||||
bool begin_line = FALSE;
|
|
||||||
size_t rev_start_len, needle_len;
|
size_t rev_start_len, needle_len;
|
||||||
|
|
||||||
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
assert(haystack != NULL && needle != NULL && rev_start != NULL);
|
||||||
|
@ -682,22 +681,19 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||||
|
|
||||||
rev_start_len = mbstrlen(rev_start);
|
rev_start_len = mbstrlen(rev_start);
|
||||||
|
|
||||||
while (!begin_line) {
|
while (TRUE) {
|
||||||
if (rev_start_len >= needle_len &&
|
if (rev_start_len >= needle_len &&
|
||||||
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
|
mbstrncasecmp(rev_start, needle, needle_len) == 0 &&
|
||||||
mblen(rev_start, MB_CUR_MAX) > 0)
|
mblen(rev_start, MB_CUR_MAX) > 0)
|
||||||
return (char *)rev_start;
|
return (char *)rev_start;
|
||||||
|
|
||||||
|
/* If we've reached the head of the haystack, we found nothing. */
|
||||||
if (rev_start == haystack)
|
if (rev_start == haystack)
|
||||||
begin_line = TRUE;
|
return NULL;
|
||||||
else {
|
|
||||||
rev_start = haystack + move_mbleft(haystack, rev_start -
|
|
||||||
haystack);
|
|
||||||
rev_start_len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
rev_start = haystack + move_mbleft(haystack, rev_start - haystack);
|
||||||
|
rev_start_len++;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
return revstrcasestr(haystack, needle, rev_start);
|
return revstrcasestr(haystack, needle, rev_start);
|
||||||
|
@ -837,22 +833,19 @@ char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (use_utf8) {
|
if (use_utf8) {
|
||||||
bool begin_line = FALSE;
|
while (TRUE) {
|
||||||
|
const char *q = (*rev_start == '\0') ?
|
||||||
while (!begin_line) {
|
NULL : mbstrchr(accept, rev_start);
|
||||||
const char *q = (*rev_start == '\0') ? NULL :
|
|
||||||
mbstrchr(accept, rev_start);
|
|
||||||
|
|
||||||
if (q != NULL)
|
if (q != NULL)
|
||||||
return (char *)rev_start;
|
return (char *)rev_start;
|
||||||
|
|
||||||
|
/* If we've reached the head of the string, we found nothing. */
|
||||||
if (rev_start == s)
|
if (rev_start == s)
|
||||||
begin_line = TRUE;
|
return NULL;
|
||||||
else
|
|
||||||
rev_start = s + move_mbleft(s, rev_start - s);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
rev_start = s + move_mbleft(s, rev_start - s);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
return revstrpbrk(s, accept, rev_start);
|
return revstrpbrk(s, accept, rev_start);
|
||||||
|
|
Loading…
Reference in New Issue