xdiff: remove emit_func() and xdi_diff_hunks()

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>

René Scharfe committed May 9, 2012 at 22:24 UTC 3319e606336c13ba6475d83e700ca53537cedfd9
4 files changed +1 -54
xdiff-interface.c
-44
@@ -156,50 +156,6 @@ int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
156 return ret;
157 }
158
159 -struct xdiff_emit_hunk_state {
160 - xdiff_emit_hunk_consume_fn consume;
161 - void *consume_callback_data;
162 -};
163 -
164 -static int process_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
165 - xdemitconf_t const *xecfg)
166 -{
167 - long s1, s2, same, p_next, t_next;
168 - xdchange_t *xch, *xche;
169 - struct xdiff_emit_hunk_state *state = ecb->priv;
170 - xdiff_emit_hunk_consume_fn fn = state->consume;
171 - void *consume_callback_data = state->consume_callback_data;
172 -
173 - for (xch = xscr; xch; xch = xche->next) {
174 - xche = xdl_get_hunk(xch, xecfg);
175 -
176 - s1 = XDL_MAX(xch->i1 - xecfg->ctxlen, 0);
177 - s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0);
178 - same = s2 + XDL_MAX(xch->i1 - s1, 0);
179 - p_next = xche->i1 + xche->chg1;
180 - t_next = xche->i2 + xche->chg2;
181 -
182 - fn(consume_callback_data, same, p_next, t_next);
183 - }
184 - return 0;
185 -}
186 -
187 -int xdi_diff_hunks(mmfile_t *mf1, mmfile_t *mf2,
188 - xdiff_emit_hunk_consume_fn fn, void *consume_callback_data,
189 - xpparam_t const *xpp, xdemitconf_t *xecfg)
190 -{
191 - struct xdiff_emit_hunk_state state;
192 - xdemitcb_t ecb;
193 -
194 - memset(&state, 0, sizeof(state));
195 - memset(&ecb, 0, sizeof(ecb));
196 - state.consume = fn;
197 - state.consume_callback_data = consume_callback_data;
198 - xecfg->emit_func = (void (*)())process_diff;
199 - ecb.priv = &state;
200 - return xdi_diff(mf1, mf2, xpp, xecfg, &ecb);
201 -}
202 -
159 int read_mmfile(mmfile_t *ptr, const char *filename)
160 {
161 struct stat st;
xdiff-interface.h
-4
@@ -4,15 +4,11 @@
4 #include "xdiff/xdiff.h"
5
6 typedef void (*xdiff_emit_consume_fn)(void *, char *, unsigned long);
7 -typedef void (*xdiff_emit_hunk_consume_fn)(void *, long, long, long);
7
8 int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t const *xecfg, xdemitcb_t *ecb);
9 int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
10 xdiff_emit_consume_fn fn, void *consume_callback_data,
11 xpparam_t const *xpp, xdemitconf_t const *xecfg);
13 -int xdi_diff_hunks(mmfile_t *mf1, mmfile_t *mf2,
14 - xdiff_emit_hunk_consume_fn fn, void *consume_callback_data,
15 - xpparam_t const *xpp, xdemitconf_t *xecfg);
12 int parse_hunk_header(char *line, int len,
13 int *ob, int *on,
14 int *nb, int *nn);
xdiff/xdiff.h
-1
@@ -96,7 +96,6 @@ typedef struct s_xdemitconf {
96 unsigned long flags;
97 find_func_t find_func;
98 void *find_func_priv;
99 - void (*emit_func)();
99 xdl_emit_hunk_consume_func_t hunk_func;
100 } xdemitconf_t;
101
xdiff/xdiffi.c
+1 -5
@@ -557,11 +557,7 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
557 xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
558 xdchange_t *xscr;
559 xdfenv_t xe;
560 - emit_func_t ef = xecfg->emit_func ?
561 - (emit_func_t)xecfg->emit_func : xdl_emit_diff;
562 -
563 - if (xecfg->hunk_func)
564 - ef = xdl_call_hunk_func;
560 + emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
561
562 if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
563