xdiff: remove unused structure, functions, and constants
authorJun Wu <quark@fb.com>
Sun, 04 Mar 2018 00:17:49 -0800
changeset 36762 b5bb0f99064d
parent 36761 09f320067591
child 36763 90f8fe72446c
xdiff: remove unused structure, functions, and constants `bdiffparam_t` is unused. `xdl_fall_back_diff` is no longer used after D2573. `XDL_MMB_READONLY`, `XDL_MMF_ATOMIC` are unused. `XDL_BDOP*` are unused since there is no xdiff binary diff algorithm. `anchors` feature is not used. It's also relatively new in git. Differential Revision: https://phab.mercurial-scm.org/D2684
mercurial/cext/bdiff.c
mercurial/thirdparty/xdiff/xdiff.h
mercurial/thirdparty/xdiff/xdiffi.h
mercurial/thirdparty/xdiff/xutils.c
mercurial/thirdparty/xdiff/xutils.h
--- a/mercurial/cext/bdiff.c	Sun Mar 04 00:07:04 2018 -0800
+++ b/mercurial/cext/bdiff.c	Sun Mar 04 00:17:49 2018 -0800
@@ -278,8 +278,6 @@
 
 	xpparam_t xpp = {
 	    XDF_INDENT_HEURISTIC, /* flags */
-	    NULL,                 /* anchors */
-	    0,                    /* anchors_nr */
 	};
 	xdemitconf_t xecfg = {
 	    0,                  /* ctxlen */
--- a/mercurial/thirdparty/xdiff/xdiff.h	Sun Mar 04 00:07:04 2018 -0800
+++ b/mercurial/thirdparty/xdiff/xdiff.h	Sun Mar 04 00:17:49 2018 -0800
@@ -41,14 +41,6 @@
  * (a1, a2 - a1, b1, b2 - b1) hunks */
 #define XDL_EMIT_BDIFFHUNK (1 << 4)
 
-#define XDL_MMB_READONLY (1 << 0)
-
-#define XDL_MMF_ATOMIC (1 << 0)
-
-#define XDL_BDOP_INS 1
-#define XDL_BDOP_CPY 2
-#define XDL_BDOP_INSB 3
-
 /* merge simplification levels */
 #define XDL_MERGE_MINIMAL 0
 #define XDL_MERGE_EAGER 1
@@ -75,10 +67,6 @@
 
 typedef struct s_xpparam {
 	unsigned long flags;
-
-	/* See Documentation/diff-options.txt. */
-	char **anchors;
-	size_t anchors_nr;
 } xpparam_t;
 
 typedef struct s_xdemitcb {
@@ -101,10 +89,6 @@
 	xdl_emit_hunk_consume_func_t hunk_func;
 } xdemitconf_t;
 
-typedef struct s_bdiffparam {
-	long bsize;
-} bdiffparam_t;
-
 
 #define xdl_malloc(x) malloc(x)
 #define xdl_free(ptr) free(ptr)
--- a/mercurial/thirdparty/xdiff/xdiffi.h	Sun Mar 04 00:07:04 2018 -0800
+++ b/mercurial/thirdparty/xdiff/xdiffi.h	Sun Mar 04 00:17:49 2018 -0800
@@ -56,9 +56,5 @@
 void xdl_free_script(xdchange_t *xscr);
 int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
 		  xdemitconf_t const *xecfg);
-int xdl_do_patience_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
-		xdfenv_t *env);
-int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
-		xdfenv_t *env);
 
 #endif /* #if !defined(XDIFFI_H) */
--- a/mercurial/thirdparty/xdiff/xutils.c	Sun Mar 04 00:07:04 2018 -0800
+++ b/mercurial/thirdparty/xdiff/xutils.c	Sun Mar 04 00:17:49 2018 -0800
@@ -241,34 +241,3 @@
 
 	return 0;
 }
-
-int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
-		int line1, int count1, int line2, int count2)
-{
-	/*
-	 * This probably does not work outside Git, since
-	 * we have a very simple mmfile structure.
-	 *
-	 * Note: ideally, we would reuse the prepared environment, but
-	 * the libxdiff interface does not (yet) allow for diffing only
-	 * ranges of lines instead of the whole files.
-	 */
-	mmfile_t subfile1, subfile2;
-	xdfenv_t env;
-
-	subfile1.ptr = (char *)diff_env->xdf1.recs[line1 - 1]->ptr;
-	subfile1.size = diff_env->xdf1.recs[line1 + count1 - 2]->ptr +
-		diff_env->xdf1.recs[line1 + count1 - 2]->size - subfile1.ptr;
-	subfile2.ptr = (char *)diff_env->xdf2.recs[line2 - 1]->ptr;
-	subfile2.size = diff_env->xdf2.recs[line2 + count2 - 2]->ptr +
-		diff_env->xdf2.recs[line2 + count2 - 2]->size - subfile2.ptr;
-	if (xdl_do_diff(&subfile1, &subfile2, xpp, &env) < 0)
-		return -1;
-
-	memcpy(diff_env->xdf1.rchg + line1 - 1, env.xdf1.rchg, count1);
-	memcpy(diff_env->xdf2.rchg + line2 - 1, env.xdf2.rchg, count2);
-
-	xdl_free_env(&env);
-
-	return 0;
-}
--- a/mercurial/thirdparty/xdiff/xutils.h	Sun Mar 04 00:07:04 2018 -0800
+++ b/mercurial/thirdparty/xdiff/xutils.h	Sun Mar 04 00:17:49 2018 -0800
@@ -38,8 +38,6 @@
 int xdl_num_out(char *out, long val);
 int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
 		      const char *func, long funclen, xdemitcb_t *ecb);
-int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
-		       int line1, int count1, int line2, int count2);