summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-07-16 23:52:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-17 20:36:25 (GMT)
commit4bbaa1eb6fb4a520069e53ec5afa977a316a5d36 (patch)
treeceb6d1a97ca5a3a78bb057b889b02fccaa4290fa /pretty.c
parentcedc61a99804db99f9a658c3cccd5c2786a28501 (diff)
downloadgit-4bbaa1eb6fb4a520069e53ec5afa977a316a5d36.zip
git-4bbaa1eb6fb4a520069e53ec5afa977a316a5d36.tar.gz
git-4bbaa1eb6fb4a520069e53ec5afa977a316a5d36.tar.bz2
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>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/pretty.c b/pretty.c
index 6e54934..ac800fa 100644
--- a/pretty.c
+++ b/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);