chars: valid UTF-8 codes are at most 4 bytes long, so look only that far
This reduces the backwards searching time by a good 20 percent.
Этот коммит содержится в:
родитель
5a3de7f117
Коммит
f162a6a2ab
@ -381,10 +381,10 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (pos < MAXCHARLEN)
|
||||
if (pos < 4)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - MAXCHARLEN;
|
||||
before = pos - 4;
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user