summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-08-14 06:18:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-14 07:30:26 (GMT)
commit8a3f524bf2ac534b313a7d8e70cc164cef744949 (patch)
treeec390ebbf7cb3d7b441043d18956abf82b40e3ad /combine-diff.c
parentb463776086a12c587f6d91c0347641fb6f7ddd72 (diff)
downloadgit-8a3f524bf2ac534b313a7d8e70cc164cef744949.zip
git-8a3f524bf2ac534b313a7d8e70cc164cef744949.tar.gz
git-8a3f524bf2ac534b313a7d8e70cc164cef744949.tar.bz2
xdiff-interface: hide the whole "xdiff_emit_state" business from the caller
This further enhances xdi_diff_outf() interface so that it takes two common parameters: the callback function that processes one line at a time, and a pointer to its application specific callback data structure. xdi_diff_outf() creates its own "xdiff_emit_state" structure and stashes these two away inside it, which is used by the lowest level output function in the xdiff_outf() callchain, consume_one(), to call back to the application layer. With this restructuring, we lift the requirement that the caller supplied callback data structure embeds xdiff_emit_state structure as its first member. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 72dd6d2..31ec0c5 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -143,8 +143,6 @@ static void append_lost(struct sline *sline, int n, const char *line, int len)
}
struct combine_diff_state {
- struct xdiff_emit_state xm;
-
unsigned int lno;
int ob, on, nb, nn;
unsigned long nmask;
@@ -218,15 +216,14 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
xpp.flags = XDF_NEED_MINIMAL;
memset(&xecfg, 0, sizeof(xecfg));
memset(&state, 0, sizeof(state));
- state.xm.consume = consume_line;
state.nmask = nmask;
state.sline = sline;
state.lno = 1;
state.num_parent = num_parent;
state.n = n;
- xdi_diff_outf(&parent_file, result_file,
- &state.xm, &xpp, &xecfg, &ecb);
+ xdi_diff_outf(&parent_file, result_file, consume_line, &state,
+ &xpp, &xecfg, &ecb);
free(parent_file.ptr);
/* Assign line numbers for this parent.