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 5/5] xdiff: remove emit_func() and xdi_diff_hunks()
Date: Wed, 09 May 2012 22:24:34 +0200 [thread overview]
Message-ID: <4FAAD282.1060105@lsrfire.ath.cx> (raw)
In-Reply-To: <4FAAD13E.8030806@lsrfire.ath.cx>
The functions are unused now, remove them.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
xdiff-interface.c | 44 --------------------------------------------
xdiff-interface.h | 4 ----
xdiff/xdiff.h | 1 -
xdiff/xdiffi.c | 6 +-----
4 files changed, 1 insertion(+), 54 deletions(-)
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 0e2c169..ecfa05f 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -156,50 +156,6 @@ int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
return ret;
}
-struct xdiff_emit_hunk_state {
- xdiff_emit_hunk_consume_fn consume;
- void *consume_callback_data;
-};
-
-static int process_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
- xdemitconf_t const *xecfg)
-{
- long s1, s2, same, p_next, t_next;
- xdchange_t *xch, *xche;
- struct xdiff_emit_hunk_state *state = ecb->priv;
- xdiff_emit_hunk_consume_fn fn = state->consume;
- void *consume_callback_data = state->consume_callback_data;
-
- for (xch = xscr; xch; xch = xche->next) {
- xche = xdl_get_hunk(xch, xecfg);
-
- s1 = XDL_MAX(xch->i1 - xecfg->ctxlen, 0);
- s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0);
- same = s2 + XDL_MAX(xch->i1 - s1, 0);
- p_next = xche->i1 + xche->chg1;
- t_next = xche->i2 + xche->chg2;
-
- fn(consume_callback_data, same, p_next, t_next);
- }
- return 0;
-}
-
-int xdi_diff_hunks(mmfile_t *mf1, mmfile_t *mf2,
- xdiff_emit_hunk_consume_fn fn, void *consume_callback_data,
- xpparam_t const *xpp, xdemitconf_t *xecfg)
-{
- struct xdiff_emit_hunk_state state;
- xdemitcb_t ecb;
-
- memset(&state, 0, sizeof(state));
- memset(&ecb, 0, sizeof(ecb));
- state.consume = fn;
- state.consume_callback_data = consume_callback_data;
- xecfg->emit_func = (void (*)())process_diff;
- ecb.priv = &state;
- return xdi_diff(mf1, mf2, xpp, xecfg, &ecb);
-}
-
int read_mmfile(mmfile_t *ptr, const char *filename)
{
struct stat st;
diff --git a/xdiff-interface.h b/xdiff-interface.h
index 49d1116..eff7762 100644
--- a/xdiff-interface.h
+++ b/xdiff-interface.h
@@ -4,15 +4,11 @@
#include "xdiff/xdiff.h"
typedef void (*xdiff_emit_consume_fn)(void *, char *, unsigned long);
-typedef void (*xdiff_emit_hunk_consume_fn)(void *, long, long, long);
int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t const *xecfg, xdemitcb_t *ecb);
int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
xdiff_emit_consume_fn fn, void *consume_callback_data,
xpparam_t const *xpp, xdemitconf_t const *xecfg);
-int xdi_diff_hunks(mmfile_t *mf1, mmfile_t *mf2,
- xdiff_emit_hunk_consume_fn fn, void *consume_callback_data,
- xpparam_t const *xpp, xdemitconf_t *xecfg);
int parse_hunk_header(char *line, int len,
int *ob, int *on,
int *nb, int *nn);
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 33c010b..219a3bb 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -96,7 +96,6 @@ typedef struct s_xdemitconf {
unsigned long flags;
find_func_t find_func;
void *find_func_priv;
- void (*emit_func)();
xdl_emit_hunk_consume_func_t hunk_func;
} xdemitconf_t;
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 4d671f4..1b7012a 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -557,11 +557,7 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
xdchange_t *xscr;
xdfenv_t xe;
- emit_func_t ef = xecfg->emit_func ?
- (emit_func_t)xecfg->emit_func : xdl_emit_diff;
-
- if (xecfg->hunk_func)
- ef = xdl_call_hunk_func;
+ emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
--
1.7.10.1
next prev parent reply other threads:[~2012-05-09 20:24 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 ` [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 ` René Scharfe [this message]
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=4FAAD282.1060105@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).