Commit f162a6a2 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
parent 5a3de7f1
Showing with 2 additions and 2 deletions
+2 -2
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment