summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Smith <whydoubt@gmail.com>2017-05-24 05:15:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-25 04:08:22 (GMT)
commit78b06e66be7806e7fa092c96a47be95984e7aee6 (patch)
tree9ac362b7d9a5621988d8fa6d6e7aca5ad4a909c3
parent8c59921dbf99cd19f1311a4eb1213312fdb41905 (diff)
downloadgit-78b06e66be7806e7fa092c96a47be95984e7aee6.zip
git-78b06e66be7806e7fa092c96a47be95984e7aee6.tar.gz
git-78b06e66be7806e7fa092c96a47be95984e7aee6.tar.bz2
blame: wrap blame_sort and compare_blame_final
The new method's interface is marginally cleaner than blame_sort, and will avoid the need to expose the compare_blame_final method. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/blame.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index d05907b..61fd5b4 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -328,12 +328,6 @@ static int compare_blame_suspect(const void *p1, const void *p2)
return s1->s_lno > s2->s_lno ? 1 : -1;
}
-static struct blame_entry *blame_sort(struct blame_entry *head,
- int (*compare_fn)(const void *, const void *))
-{
- return llist_mergesort (head, get_next_blame, set_next_blame, compare_fn);
-}
-
static int compare_commits_by_reverse_commit_date(const void *a,
const void *b,
void *c)
@@ -396,6 +390,12 @@ struct blame_scoreboard {
void *found_guilty_entry_data;
};
+static void blame_sort_final(struct blame_scoreboard *sb)
+{
+ sb->ent = llist_mergesort(sb->ent, get_next_blame, set_next_blame,
+ compare_blame_final);
+}
+
static void sanity_check_refcnt(struct blame_scoreboard *);
/*
@@ -1378,7 +1378,8 @@ static int num_scapegoats(struct rev_info *revs, struct commit *commit, int reve
*/
static void distribute_blame(struct blame_scoreboard *sb, struct blame_entry *blamed)
{
- blamed = blame_sort(blamed, compare_blame_suspect);
+ blamed = llist_mergesort(blamed, get_next_blame, set_next_blame,
+ compare_blame_suspect);
while (blamed)
{
struct blame_origin *porigin = blamed->suspect;
@@ -2922,7 +2923,7 @@ parse_done:
if (incremental)
return 0;
- sb.ent = blame_sort(sb.ent, compare_blame_final);
+ blame_sort_final(&sb);
blame_coalesce(&sb);