summaryrefslogtreecommitdiff
path: root/xdiff/xdiffi.c
diff options
context:
space:
mode:
authorBrian Downing <bdowning@lavos.net>2008-10-25 13:30:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-10-25 19:09:31 (GMT)
commitef2e62fe23173586f49a00c6ae953ebbdb0d13ab (patch)
tree13c9c71347563800dc9dfb025ad97bfcffb804f7 /xdiff/xdiffi.c
parent9ccd0a88ac3ea13ac2df4630bfd01c02084f965e (diff)
downloadgit-ef2e62fe23173586f49a00c6ae953ebbdb0d13ab.zip
git-ef2e62fe23173586f49a00c6ae953ebbdb0d13ab.tar.gz
git-ef2e62fe23173586f49a00c6ae953ebbdb0d13ab.tar.bz2
Allow alternate "low-level" emit function from xdl_diff
For some users (e.g. git blame), getting textual patch output is just extra work, as they can get all the information they need from the low- level diff structures. Allow for an alternate low-level emit function to be defined to allow bypassing the textual patch generation; set xemitconf_t's emit_func member to enable this. The (void (*)()) type is pretty ugly, but the alternative would be to include most of the private xdiff headers in xdiff.h to get the types required for the "proper" function prototype. Also, a (void *) won't work, as ANSI C doesn't allow a function pointer to be cast to an object pointer. Signed-off-by: Brian Downing <bdowning@lavos.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xdiffi.c')
-rw-r--r--xdiff/xdiffi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 1bad846..9d0324a 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -538,6 +538,8 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
xdchange_t *xscr;
xdfenv_t xe;
+ emit_func_t ef = xecfg->emit_func ?
+ (emit_func_t)xecfg->emit_func : xdl_emit_diff;
if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
@@ -551,7 +553,7 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
return -1;
}
if (xscr) {
- if (xdl_emit_diff(&xe, xscr, ecb, xecfg) < 0) {
+ if (ef(&xe, xscr, ecb, xecfg) < 0) {
xdl_free_script(xscr);
xdl_free_env(&xe);