path: root/xdiff-interface.c
diff options
authorRené Scharfe <>2010-05-04 20:41:34 (GMT)
committerJunio C Hamano <>2010-05-04 22:19:14 (GMT)
commitdfea79004c54bc96143386d6ac22de500ba4f747 (patch)
treeddaea54211bb9e03e0fc699575f74eb01546988c /xdiff-interface.c
parented215b109fc0e352456ea2ef6a0f8375e28466d5 (diff)
remove ecb parameter from xdi_diff_outf()
xdi_diff_outf() overrides the structure members of its last parameter, ignoring any value that callers pass in. It's no surprise then that all callers pass a pointer to an uninitialized structure. They also don't read it after the call, so the parameter is neither used for input nor for output. Turn it into a local variable of xdi_diff_outf(). Signed-off-by: Rene Scharfe <> Acked-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'xdiff-interface.c')
1 files changed, 6 insertions, 5 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 01f14fb..3cf39c3 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -138,19 +138,20 @@ int xdi_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdemitconf_t co
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, xdemitcb_t *xecb)
+ xpparam_t const *xpp, xdemitconf_t const *xecfg)
int ret;
struct xdiff_emit_state state;
+ xdemitcb_t ecb;
memset(&state, 0, sizeof(state));
state.consume = fn;
state.consume_callback_data = consume_callback_data;
- xecb->outf = xdiff_outf;
- xecb->priv = &state;
+ memset(&ecb, 0, sizeof(ecb));
+ ecb.outf = xdiff_outf;
+ ecb.priv = &state;
strbuf_init(&state.remainder, 0);
- ret = xdi_diff(mf1, mf2, xpp, xecfg, xecb);
+ ret = xdi_diff(mf1, mf2, xpp, xecfg, &ecb);
return ret;