Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3319e60

Browse files
René Scharfegitster
authored andcommitted
xdiff: remove emit_func() and xdi_diff_hunks()
The functions are unused now, remove them. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4b4132f commit 3319e60

File tree

4 files changed

+1
-54
lines changed

4 files changed

+1
-54
lines changed

xdiff-interface.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -156,50 +156,6 @@ int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
156156
return ret;
157157
}
158158

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-
203159
int read_mmfile(mmfile_t *ptr, const char *filename)
204160
{
205161
struct stat st;

xdiff-interface.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
#include "xdiff/xdiff.h"
55

66
typedef void (*xdiff_emit_consume_fn)(void *, char *, unsigned long);
7-
typedef void (*xdiff_emit_hunk_consume_fn)(void *, long, long, long);
87

98
int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t const *xecfg, xdemitcb_t *ecb);
109
int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
1110
xdiff_emit_consume_fn fn, void *consume_callback_data,
1211
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);
1612
int parse_hunk_header(char *line, int len,
1713
int *ob, int *on,
1814
int *nb, int *nn);

xdiff/xdiff.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ typedef struct s_xdemitconf {
9696
unsigned long flags;
9797
find_func_t find_func;
9898
void *find_func_priv;
99-
void (*emit_func)();
10099
xdl_emit_hunk_consume_func_t hunk_func;
101100
} xdemitconf_t;
102101

xdiff/xdiffi.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,7 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
557557
xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
558558
xdchange_t *xscr;
559559
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;
565561

566562
if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
567563

0 commit comments

Comments
 (0)