chars: make comparing multibyte strings twice as fast
Instead of parsing every multibyte character twice, first with parse_mbchar() and then with mbtowc(), just let mbtowc() do all the work. This makes searching for a fixed string twice as fast. This also gets rid of four variables and lots of memory allocations. (And, more importantly: it stops nano messing up the internal state of the multibyte-to-wide character conversion, and thus would make the calls to mbtowc_reset() superfluous.)
Showing
+4 -14
Please register or sign in to comment