mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 06:39:43 +03:00
tweaks: avoid parsing a character twice
Let mbtowc() do all the work, and thus also elide a variable.
This commit is contained in:
parent
967f581860
commit
15e36956b5
@ -541,7 +541,6 @@ char *mbstrchr(const char *s, const char *c)
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char symbol[MAXCHARLEN];
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
|
||||
@ -551,9 +550,9 @@ char *mbstrchr(const char *s, const char *c)
|
||||
}
|
||||
|
||||
while (*s != '\0') {
|
||||
int sym_len = parse_mbchar(s, symbol, NULL);
|
||||
int sym_len = mbtowc(&ws, s, MAXCHARLEN);
|
||||
|
||||
if (mbtowc(&ws, symbol, sym_len) < 0) {
|
||||
if (sym_len < 0) {
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user