changeset 29010:e868d8ee7c8f stable

bdiff: unify duplicate normalize loops We're about to make the while loop check more complicated, so let's simplify first.
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Apr 2016 21:37:13 -0500
parents c05cc1b95848
children 8bcda4c76820
files mercurial/bdiff.c
diffstat 1 files changed, 1 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bdiff.c	Mon Apr 25 16:34:02 2016 -0700
+++ b/mercurial/bdiff.c	Thu Apr 21 21:37:13 2016 -0500
@@ -264,16 +264,11 @@
 		if (!next)
 			break;
 
-		if (curr->a2 == next->a1)
+		if (curr->a2 == next->a1 || curr->b2 == next->b1)
 			while (curr->a2 + shift < an && curr->b2 + shift < bn
 			       && !cmp(a + curr->a2 + shift,
 				       b + curr->b2 + shift))
 				shift++;
-		else if (curr->b2 == next->b1)
-			while (curr->b2 + shift < bn && curr->a2 + shift < an
-			       && !cmp(b + curr->b2 + shift,
-				       a + curr->a2 + shift))
-				shift++;
 		if (!shift)
 			continue;
 		curr->b2 += shift;