From 4bbaa1eb6fb4a520069e53ec5afa977a316a5d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 17 Jul 2014 01:52:09 +0200 Subject: use commit_list_count() to count the members of commit_lists Call commit_list_count() instead of open-coding it repeatedly. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- commit.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'commit.c') diff --git a/commit.c b/commit.c index 61d2e13f48..464a139e61 100644 --- 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; -- cgit v1.2.3