path: root/xdiff-interface.c
diff options
authorBrian Downing <>2008-08-14 05:36:50 (GMT)
committerJunio C Hamano <>2008-08-14 06:10:23 (GMT)
commitc99db9d292c5f63c83ae2b441a67121d76553413 (patch)
treebdb63fae285ccaa9b54dbe9a4bde0ec1ac41bc96 /xdiff-interface.c
parenta0653d550524a0263d36fde6a8cf98941dd057ab (diff)
Make xdi_diff_outf interface for running xdiff_outf diffs
To prepare for the need to initialize and release resources for an xdi_diff with the xdiff_outf output function, make a new function to wrap this usage. Old: ecb.outf = xdiff_outf; ecb.priv = &state; ... xdi_diff(file_p, file_o, &xpp, &xecfg, &ecb); New: xdi_diff_outf(file_p, file_o, &state.xm, &xpp, &xecfg, &ecb); Signed-off-by: Brian Downing <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'xdiff-interface.c')
1 files changed, 12 insertions, 1 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 61dc5c5..828b496 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -61,7 +61,7 @@ static void consume_one(void *priv_, char *s, unsigned long size)
-int xdiff_outf(void *priv_, mmbuffer_t *mb, int nbuf)
+static int xdiff_outf(void *priv_, mmbuffer_t *mb, int nbuf)
struct xdiff_emit_state *priv = priv_;
int i;
@@ -141,6 +141,17 @@ int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t co
return xdl_diff(&a, &b, xpp, xecfg, xecb);
+int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
+ struct xdiff_emit_state *state, xpparam_t const *xpp,
+ xdemitconf_t const *xecfg, xdemitcb_t *xecb)
+ int ret;
+ xecb->outf = xdiff_outf;
+ xecb->priv = state;
+ ret = xdi_diff(mf1, mf2, xpp, xecfg, xecb);
+ return ret;
int read_mmfile(mmfile_t *ptr, const char *filename)
struct stat st;