Skip to content

Commit 5d23ec7

Browse files
René Scharfegitster
authored andcommitted
blame: use hunk_func(), part 2
Use handle_split_cb() directly as hunk_func() callback, without going through xdi_diff_hunks(). Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0af596c commit 5d23ec7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

builtin/blame.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,12 +906,15 @@ struct handle_split_cb_data {
906906
long tlno;
907907
};
908908

909-
static void handle_split_cb(void *data, long same, long p_next, long t_next)
909+
static int handle_split_cb(long start_a, long count_a,
910+
long start_b, long count_b, void *data)
910911
{
911912
struct handle_split_cb_data *d = data;
912-
handle_split(d->sb, d->ent, d->tlno, d->plno, same, d->parent, d->split);
913-
d->plno = p_next;
914-
d->tlno = t_next;
913+
handle_split(d->sb, d->ent, d->tlno, d->plno, start_b, d->parent,
914+
d->split);
915+
d->plno = start_a + count_a;
916+
d->tlno = start_b + count_b;
917+
return 0;
915918
}
916919

917920
/*
@@ -931,6 +934,8 @@ static void find_copy_in_blob(struct scoreboard *sb,
931934
struct handle_split_cb_data d;
932935
xpparam_t xpp;
933936
xdemitconf_t xecfg;
937+
xdemitcb_t ecb;
938+
934939
memset(&d, 0, sizeof(d));
935940
d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
936941
/*
@@ -954,8 +959,11 @@ static void find_copy_in_blob(struct scoreboard *sb,
954959
xpp.flags = xdl_opts;
955960
memset(&xecfg, 0, sizeof(xecfg));
956961
xecfg.ctxlen = 1;
962+
xecfg.hunk_func = handle_split_cb;
963+
memset(&ecb, 0, sizeof(ecb));
964+
ecb.priv = &d;
957965
memset(split, 0, sizeof(struct blame_entry [3]));
958-
xdi_diff_hunks(file_p, &file_o, handle_split_cb, &d, &xpp, &xecfg);
966+
xdi_diff(file_p, &file_o, &xpp, &xecfg, &ecb);
959967
/* remainder, if any, all match the preimage */
960968
handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, parent, split);
961969
}

0 commit comments

Comments
 (0)