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 2/5] blame: use hunk_func(), part 1
Date: Wed, 09 May 2012 22:21:56 +0200 [thread overview]
Message-ID: <4FAAD1E4.30906@lsrfire.ath.cx> (raw)
In-Reply-To: <4FAAD13E.8030806@lsrfire.ath.cx>
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>
---
builtin/blame.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index 324d476..9ae5cf3 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -759,12 +759,14 @@ struct blame_chunk_cb_data {
long tlno;
};
-static void blame_chunk_cb(void *data, long same, long p_next, long t_next)
+static int blame_chunk_cb(long start_a, long count_a,
+ long start_b, long count_b, void *data)
{
struct blame_chunk_cb_data *d = data;
- blame_chunk(d->sb, d->tlno, d->plno, same, d->target, d->parent);
- d->plno = p_next;
- d->tlno = t_next;
+ blame_chunk(d->sb, d->tlno, d->plno, start_b, d->target, d->parent);
+ d->plno = start_a + count_a;
+ d->tlno = start_b + count_b;
+ return 0;
}
/*
@@ -781,6 +783,8 @@ static int pass_blame_to_parent(struct scoreboard *sb,
struct blame_chunk_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
+ xdemitcb_t ecb;
+
memset(&d, 0, sizeof(d));
d.sb = sb; d.target = target; d.parent = parent;
last_in_target = find_last_in_target(sb, target);
@@ -795,7 +799,10 @@ static int pass_blame_to_parent(struct scoreboard *sb,
xpp.flags = xdl_opts;
memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 0;
- xdi_diff_hunks(&file_p, &file_o, blame_chunk_cb, &d, &xpp, &xecfg);
+ xecfg.hunk_func = blame_chunk_cb;
+ memset(&ecb, 0, sizeof(ecb));
+ ecb.priv = &d;
+ xdi_diff(&file_p, &file_o, &xpp, &xecfg, &ecb);
/* The rest (i.e. anything after tlno) are the same as the parent */
blame_chunk(sb, d.tlno, d.plno, last_in_target, target, parent);
--
1.7.10.1
next prev parent reply other threads:[~2012-05-09 20:22 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 ` René Scharfe [this message]
2012-05-09 20:22 ` [PATCH 3/5] blame: use hunk_func(), part 2 René Scharfe
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=4FAAD1E4.30906@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).