Change while loop into for loop
authorMichael Haggerty <mhagger@alum.mit.edu>
Fri, 12 Aug 2011 21:43:09 +0000 (23:43 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 14 Aug 2011 22:02:00 +0000 (15:02 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
diff --git a/attr.c b/attr.c
index a7d1aa95d215b2259afeecbbe20506921d33fd6d..b56542e7234161518a131d3e3edbb8c20c50fbab 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -228,14 +228,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
 
        for (pass = 0; pass < 2; pass++) {
                /* pass 0 counts and allocates, pass 1 fills */
 
        for (pass = 0; pass < 2; pass++) {
                /* pass 0 counts and allocates, pass 1 fills */
-               num_attr = 0;
-               cp = states;
-               while (*cp) {
+               for (cp = states, num_attr = 0; *cp; num_attr++) {
                        cp = parse_attr(src, lineno, cp,
                                pass ? &(res->state[num_attr]) : NULL);
                        if (!cp)
                                return NULL;
                        cp = parse_attr(src, lineno, cp,
                                pass ? &(res->state[num_attr]) : NULL);
                        if (!cp)
                                return NULL;
-                       num_attr++;
                }
                if (pass)
                        break;
                }
                if (pass)
                        break;