From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: git discussion list <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/5] blame: use hunk_func(), part 2
Date: Wed, 09 May 2012 22:22:47 +0200 [thread overview]
Message-ID: <4FAAD217.6040702@lsrfire.ath.cx> (raw)
In-Reply-To: <4FAAD13E.8030806@lsrfire.ath.cx>
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>
---
builtin/blame.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 9ae5cf3..c83fc7c 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -906,12 +906,15 @@ struct handle_split_cb_data {
long tlno;
};
-static void handle_split_cb(void *data, long same, long p_next, long t_next)
+static int handle_split_cb(long start_a, long count_a,
+ long start_b, long count_b, void *data)
{
struct handle_split_cb_data *d = data;
- handle_split(d->sb, d->ent, d->tlno, d->plno, same, d->parent, d->split);
- d->plno = p_next;
- d->tlno = t_next;
+ handle_split(d->sb, d->ent, d->tlno, d->plno, start_b, d->parent,
+ d->split);
+ d->plno = start_a + count_a;
+ d->tlno = start_b + count_b;
+ return 0;
}
/*
@@ -931,6 +934,8 @@ static void find_copy_in_blob(struct scoreboard *sb,
struct handle_split_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
+ xdemitcb_t ecb;
+
memset(&d, 0, sizeof(d));
d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
/*
@@ -954,8 +959,11 @@ static void find_copy_in_blob(struct scoreboard *sb,
xpp.flags = xdl_opts;
memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 1;
+ xecfg.hunk_func = handle_split_cb;
+ memset(&ecb, 0, sizeof(ecb));
+ ecb.priv = &d;
memset(split, 0, sizeof(struct blame_entry [3]));
- xdi_diff_hunks(file_p, &file_o, handle_split_cb, &d, &xpp, &xecfg);
+ xdi_diff(file_p, &file_o, &xpp, &xecfg, &ecb);
/* remainder, if any, all match the preimage */
handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, parent, split);
}
--
1.7.10.1
next prev parent reply other threads:[~2012-05-09 20:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 20:19 [PATCH 0/5] xdiff: replace emit_func() with type-safe René Scharfe
2012-05-09 20:20 ` [PATCH 1/5] xdiff: add hunk_func() René Scharfe
2012-05-09 20:21 ` [PATCH 2/5] blame: use hunk_func(), part 1 René Scharfe
2012-05-09 20:22 ` René Scharfe [this message]
2012-05-09 20:23 ` [PATCH 4/5] blame: factor out helper for calling xdi_diff() René Scharfe
2012-05-09 20:24 ` [PATCH 5/5] xdiff: remove emit_func() and xdi_diff_hunks() René Scharfe
2012-05-18 8:28 ` [PATCH 0/5] xdiff: replace emit_func() with type-safe Thomas Rast
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FAAD217.6040702@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.