From: Junio C Hamano Date: Thu, 14 Aug 2008 02:13:23 GMT Subject: Re: [PATCH 1/2] Make xdiff_outf_{init,release} interface Message-ID: <7viqu4gx8c.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20080814020614.GD4396@lavos.net> bdowning@lavos.net (Brian Downing) writes: >> Although I wish xdi_diff() could do the necessary clean-up immediately >> before it returns (so that the caller did not have to do anything >> special), it is not possible to do so cleanly, because there are >> "outf" implementations other than xdiff_outf that do not even use >> "struct xdiff_emit_state" in their callbacks. So I think your patch >> makes sense. > > Well, I could do something like: > > if (xecb->outf == xdiff_outf) > /* xdiff_outf cleanup */ > > at the end of xdi_diff, but that's... kind of horrible I think. Yeah, that is ugly, and that is why I said I think your patch makes sense. > For that matter, I could just make an xdi_outf_diff function that would > take the state in addition to the other xdi_diff arguments and go ahead > and set it up, do the diff, and tear it down in one step. Maybe that > would be better if it works for everywhere this style of diff needs to > be called. Yeah, most of the xdi_diff() callers do use the stock outf so it would make sense.