Merge branch 'sb/wt-status-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Tue, 21 Mar 2017 22:07:18 +0000 (15:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Mar 2017 22:07:18 +0000 (15:07 -0700)
Code clean-up.

* sb/wt-status-cleanup:
wt-status: simplify by using for_each_string_list_item

wt-status.c
index cc446f26ba40a6813c69b649656210bc6e3f98ae..308cf3779eb05b0953edd5aaeeae26f95104240f 100644 (file)
@@ -1785,34 +1785,24 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
 
 static void wt_shortstatus_print(struct wt_status *s)
 {
-       int i;
+       struct string_list_item *it;
 
        if (s->show_branch)
                wt_shortstatus_print_tracking(s);
 
-       for (i = 0; i < s->change.nr; i++) {
-               struct wt_status_change_data *d;
-               struct string_list_item *it;
+       for_each_string_list_item(it, &s->change) {
+               struct wt_status_change_data *d = it->util;
 
-               it = &(s->change.items[i]);
-               d = it->util;
                if (d->stagemask)
                        wt_shortstatus_unmerged(it, s);
                else
                        wt_shortstatus_status(it, s);
        }
-       for (i = 0; i < s->untracked.nr; i++) {
-               struct string_list_item *it;
-
-               it = &(s->untracked.items[i]);
+       for_each_string_list_item(it, &s->untracked)
                wt_shortstatus_other(it, s, "??");
-       }
-       for (i = 0; i < s->ignored.nr; i++) {
-               struct string_list_item *it;
 
-               it = &(s->ignored.items[i]);
+       for_each_string_list_item(it, &s->ignored)
                wt_shortstatus_other(it, s, "!!");
-       }
 }
 
 static void wt_porcelain_print(struct wt_status *s)