diff options
author | Stefan Beller <sbeller@google.com> | 2017-03-16 14:36:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-17 10:32:45 -0700 |
commit | d4aae459cd217c9201e03b270112f5b3ead1f867 (patch) | |
tree | 0a27c24d1955ffa9b83ae778e4b479d61d62acdb | |
parent | Preparing for 2.12.1 (diff) | |
download | tgif-d4aae459cd217c9201e03b270112f5b3ead1f867.tar.xz |
wt-status: simplify by using for_each_string_list_item
Improve readability by using the for_each_string_list_item helper
instead of manually iterating with an integer counter.
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | wt-status.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/wt-status.c b/wt-status.c index d47012048f..a52d342695 100644 --- a/wt-status.c +++ b/wt-status.c @@ -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) |