use commit_list_count() to count the members of commit_lists
[gitweb.git] / commit.c
index 61d2e13f4870a47be3f48b7cebeee8ba4ceaee1b..464a139e611343742a0d9c2540428d138439f462 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -987,12 +987,7 @@ struct commit_list *get_merge_bases_many(struct commit *one,
        }
 
        /* There are more than one */
-       cnt = 0;
-       list = result;
-       while (list) {
-               list = list->next;
-               cnt++;
-       }
+       cnt = commit_list_count(result);
        rslt = xcalloc(cnt, sizeof(*rslt));
        for (list = result, i = 0; list; list = list->next)
                rslt[i++] = list->item;