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 --- line-log.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'line-log.c') diff --git a/line-log.c b/line-log.c index afcc98db9..1008e7225 100644 --- a/line-log.c +++ b/line-log.c @@ -766,17 +766,6 @@ void line_log_init(struct rev_info *rev, const char *prefix, struct string_list } } -static int count_parents(struct commit *commit) -{ - struct commit_list *parents = commit->parents; - int count = 0; - while (parents) { - count++; - parents = parents->next; - } - return count; -} - static void move_diff_queue(struct diff_queue_struct *dst, struct diff_queue_struct *src) { @@ -1150,7 +1139,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm struct commit **parents; struct commit_list *p; int i; - int nparents = count_parents(commit); + int nparents = commit_list_count(commit->parents); diffqueues = xmalloc(nparents * sizeof(*diffqueues)); cand = xmalloc(nparents * sizeof(*cand)); -- cgit v1.2.1