changeset 29323:d29cb5e735e9 stable

bdiff: remove effectively dead code Now that we extend matches backwards in the inner loop, the final adjustment has no effect. (A similar extension for the forward direction is trickier and has less benefit.)
author Matt Mackall <mpm@selenic.com>
date Thu, 02 Jun 2016 17:11:32 -0500
parents 66dbdd3cc2b9
children 60621cecc8c5 f359cdc91e21
files mercurial/bdiff.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bdiff.c	Thu Jun 02 17:09:06 2016 -0500
+++ b/mercurial/bdiff.c	Thu Jun 02 17:11:32 2016 -0500
@@ -148,7 +148,7 @@
 static int longest_match(struct line *a, struct line *b, struct pos *pos,
 			 int a1, int a2, int b1, int b2, int *omi, int *omj)
 {
-	int mi = a1, mj = b1, mk = 0, mb = 0, i, j, k, half;
+	int mi = a1, mj = b1, mk = 0, i, j, k, half;
 
 	/* window our search on large regions to better bound
 	   worst-case performance. by choosing a window at the end, we
@@ -195,18 +195,15 @@
 		mj = mj - mk + 1;
 	}
 
-	/* expand match to include neighboring popular lines */
-	while (mi - mb > a1 && mj - mb > b1 &&
-	       a[mi - mb - 1].e == b[mj - mb - 1].e)
-		mb++;
+	/* expand match to include subsequent popular lines */
 	while (mi + mk < a2 && mj + mk < b2 &&
 	       a[mi + mk].e == b[mj + mk].e)
 		mk++;
 
-	*omi = mi - mb;
-	*omj = mj - mb;
+	*omi = mi;
+	*omj = mj;
 
-	return mk + mb;
+	return mk;
 }
 
 static struct hunk *recurse(struct line *a, struct line *b, struct pos *pos,