From: Daniel Carl Date: Sat, 6 Sep 2014 23:09:51 +0000 (+0200) Subject: Use for loops instead of while. X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=b4d37f31552b6f8b74ae59e711aa17e03fe8bbde;p=vimb.git Use for loops instead of while. --- diff --git a/src/util.c b/src/util.c index 92d5d26..e42fc57 100644 --- a/src/util.c +++ b/src/util.c @@ -648,17 +648,13 @@ static gboolean match_list(const char *pattern, int patlen, const char *subject) int endlen; const char *end, *s; - end = pattern; - endlen = patlen; /* finde the next none escaped '}' */ - while (endlen > 0 && *end != '}') { + for (end = pattern, endlen = patlen; endlen > 0 && *end != '}'; end++, endlen--) { /* if escape char - move pointer one additional step */ if (*end == '\\') { end++; endlen--; } - end++; - endlen--; } if (!*end) { @@ -701,14 +697,12 @@ static gboolean match_list(const char *pattern, int patlen, const char *subject) /* this item of the list does not match - move forward to * the next none escaped ',' or '}' */ s = subject; - while (*pattern != ',' && *pattern != '}') { + for (s = subject; *pattern != ',' && *pattern != '}'; pattern++, patlen--) { /* if escape char is found - skip next char */ if (*pattern == '\\') { pattern++; patlen--; } - pattern++; - patlen--; } /* found ',' skip over it to check the next list item */ if (*pattern == ',') {