xdiff: remove emit_func() and xdi_diff_hunks()
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Wed, 9 May 2012 20:24:34 +0000 (22:24 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 May 2012 21:08:42 +0000 (14:08 -0700)
The functions are unused now, remove them.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff-interface.c
xdiff-interface.h
xdiff/xdiff.h
xdiff/xdiffi.c

index 0e2c169227ad29b5bf546c6c1b97e1a1d8ed7409..ecfa05f616f4b72d65bcb129c1ee2141cf3d1c47 100644 (file)
@@ -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;
index 49d1116fc34f536ab9358313522a25564dd1f6c3..eff7762ee1a1bb0ea648c60a07389e22e9a1ac07 100644 (file)
@@ -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);
index 33c010b1f117154501a3043d2328fd0b2517204e..219a3bbca613192d8b127659e4bfc0d60f38cf10 100644 (file)
@@ -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;
 
index 4d671f4371fab0e9f3b250a4a3e133ae0374f57d..1b7012a119ad3ea7e2ebe0aad80891529d4936da 100644 (file)
@@ -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) {