nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit b305911cbaa6d902c01d8db85a41696c6e4a78fc
parent d60f95137e9e0e705f81668af0a4ad14f5ab48b5
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Wed, 27 Jul 2016 22:03:48 +0200

chars: straighten out the flow of a loop, so it is easier to follow

Diffstat:
Msrc/chars.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/chars.c b/src/chars.c @@ -512,8 +512,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) assert(s1 != NULL && s2 != NULL); - for (; *s1 != '\0' && *s2 != '\0' && n > 0; - s1 += move_mbright(s1, 0), s2 += move_mbright(s2, 0), n--) { + while (*s1 != '\0' && *s2 != '\0' && n > 0) { bool bad1 = FALSE, bad2 = FALSE; if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) { @@ -530,6 +529,10 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) if (bad1 != bad2 || towlower(wc1) != towlower(wc2)) break; + + s1 += move_mbright(s1, 0); + s2 += move_mbright(s2, 0); + n--; } return (n > 0) ? towlower(wc1) - towlower(wc2) : 0;