D2628: xdiff: expand xdl_optimize_ctxs
quark (Jun Wu)
phabricator at mercurial-scm.org
Sun Mar 4 02:51:49 UTC 2018
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The function has 2 steps: trim_ends, and cleanup_records. We'll be inserting
something in-between that is not "optimize", but "initialize". So expand the
function to make the latter change easier.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2628
AFFECTED FILES
mercurial/thirdparty/xdiff/xprepare.c
CHANGE DETAILS
diff --git a/mercurial/thirdparty/xdiff/xprepare.c b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -62,7 +62,6 @@
static int xdl_clean_mmatch(char const *dis, long i, long s, long e);
static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2);
static int xdl_trim_ends(xdfile_t *xdf1, xdfile_t *xdf2);
-static int xdl_optimize_ctxs(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2);
@@ -282,7 +281,14 @@
return -1;
}
- if (xdl_optimize_ctxs(&cf, &xe->xdf1, &xe->xdf2) < 0) {
+ if (xdl_trim_ends(&xe->xdf1, &xe->xdf2) < 0) {
+ xdl_free_ctx(&xe->xdf2);
+ xdl_free_ctx(&xe->xdf1);
+ xdl_free_classifier(&cf);
+ return -1;
+ }
+
+ if (xdl_cleanup_records(&cf, &xe->xdf1, &xe->xdf2) < 0) {
xdl_free_ctx(&xe->xdf2);
xdl_free_ctx(&xe->xdf1);
xdl_free_classifier(&cf);
@@ -452,15 +458,3 @@
return 0;
}
-
-
-static int xdl_optimize_ctxs(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) {
-
- if (xdl_trim_ends(xdf1, xdf2) < 0 ||
- xdl_cleanup_records(cf, xdf1, xdf2) < 0) {
-
- return -1;
- }
-
- return 0;
-}
To: quark, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list