blame: use hunk_func(), part 1
Use blame_chunk_cb() directly as hunk_func() callback, without detour 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:21 UTC
0af596c6ffba19bff4362ac532be35abd67d2630
1 file changed
+12
-5
builtin/blame.c
+12
-5
@@ -759,12 +759,14 @@ struct blame_chunk_cb_data {
759
long tlno;
760
};
761
762
-static void blame_chunk_cb(void *data, long same, long p_next, long t_next)
762
+static int blame_chunk_cb(long start_a, long count_a,
763
+ long start_b, long count_b, void *data)
764
{
765
struct blame_chunk_cb_data *d = data;
765
- blame_chunk(d->sb, d->tlno, d->plno, same, d->target, d->parent);
766
- d->plno = p_next;
767
- d->tlno = t_next;
766
+ blame_chunk(d->sb, d->tlno, d->plno, start_b, d->target, d->parent);
767
+ d->plno = start_a + count_a;
768
+ d->tlno = start_b + count_b;
769
+ return 0;
770
}
771
772
/*
@@ -781,6 +783,8 @@ static int pass_blame_to_parent(struct scoreboard *sb,
783
struct blame_chunk_cb_data d;
784
xpparam_t xpp;
785
xdemitconf_t xecfg;
786
+ xdemitcb_t ecb;
787
+
788
memset(&d, 0, sizeof(d));
789
d.sb = sb; d.target = target; d.parent = parent;
790
last_in_target = find_last_in_target(sb, target);
@@ -795,7 +799,10 @@ static int pass_blame_to_parent(struct scoreboard *sb,
799
xpp.flags = xdl_opts;
800
memset(&xecfg, 0, sizeof(xecfg));
801
xecfg.ctxlen = 0;
798
- xdi_diff_hunks(&file_p, &file_o, blame_chunk_cb, &d, &xpp, &xecfg);
802
+ xecfg.hunk_func = blame_chunk_cb;
803
+ memset(&ecb, 0, sizeof(ecb));
804
+ ecb.priv = &d;
805
+ xdi_diff(&file_p, &file_o, &xpp, &xecfg, &ecb);
806
/* The rest (i.e. anything after tlno) are the same as the parent */
807
blame_chunk(sb, d.tlno, d.plno, last_in_target, target, parent);
808