1
1

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.
Этот коммит содержится в:
Benno Schulenberg 2017-05-02 10:50:43 +02:00
родитель 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);