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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cedc61a998
commit
4bbaa1eb6f
7
pretty.c
7
pretty.c
@ -1556,12 +1556,7 @@ static void pp_header(struct pretty_print_context *pp,
|
||||
}
|
||||
|
||||
if (!parents_shown) {
|
||||
struct commit_list *parent;
|
||||
int num;
|
||||
for (parent = commit->parents, num = 0;
|
||||
parent;
|
||||
parent = parent->next, num++)
|
||||
;
|
||||
unsigned num = commit_list_count(commit->parents);
|
||||
/* with enough slop */
|
||||
strbuf_grow(sb, num * 50 + 20);
|
||||
add_merge_info(pp, sb, commit);
|
||||
|
Reference in New Issue
Block a user