diff options
author | Junio C Hamano <junkio@cox.net> | 2006-11-29 12:06:49 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-02 17:28:19 -0800 |
commit | 53a7085a104936aef29400369aab15e0d1ccbb28 (patch) | |
tree | 8a37aa9d56fbd7fd50559ed5cb28099ef9461935 /xdiff | |
parent | xdiff: add xdl_merge() (diff) | |
download | tgif-53a7085a104936aef29400369aab15e0d1ccbb28.tar.xz |
xmerge: make return value from xdl_merge() more usable.
The callers would want to know if the resulting merge is clean;
do not discard that information away after calling xdl_do_merge().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xmerge.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c index 7b85aa5906..286f177b54 100644 --- a/xdiff/xmerge.c +++ b/xdiff/xmerge.c @@ -384,6 +384,7 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1, xpparam_t const *xpp, int level, mmbuffer_t *result) { xdchange_t *xscr1, *xscr2; xdfenv_t xe1, xe2; + int status; result->ptr = NULL; result->size = 0; @@ -404,6 +405,7 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1, xdl_free_env(&xe2); return -1; } + status = 0; if (xscr1 || xscr2) { if (!xscr1) { result->ptr = xdl_malloc(mf2->size); @@ -413,14 +415,10 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1, result->ptr = xdl_malloc(mf1->size); memcpy(result->ptr, mf1->ptr, mf1->size); result->size = mf1->size; - } else if (xdl_do_merge(&xe1, xscr1, name1, - &xe2, xscr2, name2, - level, xpp, result) < 0) { - xdl_free_script(xscr1); - xdl_free_script(xscr2); - xdl_free_env(&xe1); - xdl_free_env(&xe2); - return -1; + } else { + status = xdl_do_merge(&xe1, xscr1, name1, + &xe2, xscr2, name2, + level, xpp, result); } xdl_free_script(xscr1); xdl_free_script(xscr2); @@ -428,6 +426,5 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1, xdl_free_env(&xe1); xdl_free_env(&xe2); - return 0; + return status; } - |