attr.c: simplify macroexpand_one()
[gitweb.git] / attr.c
diff --git a/attr.c b/attr.c
index 17297fffee718b03f7d9900dc675bc54725e4aaa..e42f931b356d6b5869455f742a62447bdac3ca70 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -705,24 +705,21 @@ static int fill(const char *path, int pathlen, int basename_offset,
 static int macroexpand_one(int nr, int rem)
 {
        struct attr_stack *stk;
-       struct match_attr *a = NULL;
        int i;
 
        if (check_all_attr[nr].value != ATTR__TRUE ||
            !check_all_attr[nr].attr->maybe_macro)
                return rem;
 
-       for (stk = attr_stack; !a && stk; stk = stk->prev)
-               for (i = stk->num_matches - 1; !a && 0 <= i; i--) {
+       for (stk = attr_stack; stk; stk = stk->prev) {
+               for (i = stk->num_matches - 1; 0 <= i; i--) {
                        struct match_attr *ma = stk->attrs[i];
                        if (!ma->is_macro)
                                continue;
                        if (ma->u.attr->attr_nr == nr)
-                               a = ma;
+                               return fill_one("expand", ma, rem);
                }
-
-       if (a)
-               rem = fill_one("expand", a, rem);
+       }
 
        return rem;
 }