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>
René Scharfe committed
May 9, 2012 at 22:22 UTC
5d23ec7664ed41afd92d9d8d7ce5e75f87564f0d
1 file changed
+13
-5
builtin/blame.c
+13
-5
@@ -906,12 +906,15 @@ struct handle_split_cb_data {
906
long tlno;
907
};
908
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)
911
{
912
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;
918
}
919
920
/*
@@ -931,6 +934,8 @@ static void find_copy_in_blob(struct scoreboard *sb,
934
struct handle_split_cb_data d;
935
xpparam_t xpp;
936
xdemitconf_t xecfg;
937
+ xdemitcb_t ecb;
938
+
939
memset(&d, 0, sizeof(d));
940
d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
941
/*
@@ -954,8 +959,11 @@ static void find_copy_in_blob(struct scoreboard *sb,
959
xpp.flags = xdl_opts;
960
memset(&xecfg, 0, sizeof(xecfg));
961
xecfg.ctxlen = 1;
962
+ xecfg.hunk_func = handle_split_cb;
963
+ memset(&ecb, 0, sizeof(ecb));
964
+ ecb.priv = &d;
965
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);
967
/* remainder, if any, all match the preimage */
968
handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, parent, split);
969
}