Commit Diff


commit - f6db314590fc96c0cdbf87367b47da8603e17ae9
commit + 7280e29c8ed198cf9253d84bb9289e55adaabf12
blob - 5eaebfacda33fd3b4931e4077bfad705adb4803c
blob + a286036a2ee2b4911b7aa95172020f4192c56f5d
--- lib/diff_myers.c
+++ lib/diff_myers.c
@@ -222,18 +222,10 @@ diff_divide_myers_forward(bool *found_midpoint,
 	int x_before_slide;
 	*found_midpoint = false;
 
-	debug("-- %s d=%d\n", __func__, d);
-
 	for (k = d; k >= -d; k -= 2) {
 		if (k < -(int)right->atoms.len || k > (int)left->atoms.len) {
 			/* This diagonal is completely outside of the Myers
 			 * graph, don't calculate it. */
-			if (k < -(int)right->atoms.len)
-				debug(" %d k < -(int)right->atoms.len %d\n", k,
-				      -(int)right->atoms.len);
-			else
-				debug(" %d k > left->atoms.len %d\n", k,
-				      left->atoms.len);
 			if (k < 0) {
 				/* We are traversing negatively, and already
 				 * below the entire graph, nothing will come of
@@ -244,7 +236,6 @@ diff_divide_myers_forward(bool *found_midpoint,
 			debug(" continue\n");
 			continue;
 		}
-		debug("- k = %d\n", k);
 		if (d == 0) {
 			/* This is the initializing step. There is no prev_k
 			 * yet, get the initial x from the top left of the Myers
@@ -319,6 +310,7 @@ diff_divide_myers_forward(bool *found_midpoint,
 			x++;
 		}
 		kd_forward[k] = x;
+#if 0
 		if (x_before_slide != x) {
 			debug("  down %d similar lines\n", x - x_before_slide);
 		}
@@ -332,6 +324,7 @@ diff_divide_myers_forward(bool *found_midpoint,
 			}
 		}
 #endif
+#endif
 
 		if (x < 0 || x > left->atoms.len
 		    || xk_to_y(x, k) < 0 || xk_to_y(x, k) > right->atoms.len)
@@ -389,8 +382,6 @@ diff_divide_myers_forward(bool *found_midpoint,
 		int backwards_d = d - 1;
 		if (backwards_d < 0)
 			continue;
-
-		debug("backwards_d = %d\n", backwards_d);
 
 		/* If both sides have the same length, forward and backward
 		 * start on the same diagonal, meaning the backwards state index
@@ -452,9 +443,6 @@ diff_divide_myers_forward(bool *found_midpoint,
 			 * it reaches when sliding down identical lines.
 			 */
 			int backward_x = kd_backward[c];
-			debug("Compare:  k=%d c=%d  is (%d,%d) >= (%d,%d)?\n",
-			      k, c, x, xk_to_y(x, k), backward_x,
-			      xc_to_y(backward_x, c, delta));
 			if (x >= backward_x) {
 				if (x_before_slide != x) {
 					/* met after sliding up a mid-snake */
@@ -493,8 +481,6 @@ diff_divide_myers_forward(bool *found_midpoint,
 		}
 	}
 
-	debug_dump_myers_graph(left, right, NULL, kd_forward, d,
-			       kd_backward, d-1);
 	return 0;
 }
 
@@ -535,29 +521,18 @@ diff_divide_myers_backward(bool *found_midpoint,
 
 	*found_midpoint = false;
 
-	debug("-- %s d=%d\n", __func__, d);
-
 	for (c = d; c >= -d; c -= 2) {
 		if (c < -(int)left->atoms.len || c > (int)right->atoms.len) {
 			/* This diagonal is completely outside of the Myers
 			 * graph, don't calculate it. */
-			if (c < -(int)left->atoms.len)
-				debug(" %d c < -(int)left->atoms.len %d\n", c,
-				      -(int)left->atoms.len);
-			else
-				debug(" %d c > right->atoms.len %d\n", c,
-				      right->atoms.len);
 			if (c < 0) {
 				/* We are traversing negatively, and already
 				 * below the entire graph, nothing will come of
 				 * this. */
-				debug(" break\n");
 				break;
 			}
-			debug(" continue\n");
 			continue;
 		}
-		debug("- c = %d\n", c);
 		if (d == 0) {
 			/* This is the initializing step. There is no prev_c
 			 * yet, get the initial x from the bottom right of the
@@ -619,6 +594,7 @@ diff_divide_myers_backward(bool *found_midpoint,
 
 		/* Slide up any snake that we might find here (sections of
 		 * identical lines on both sides). */
+#if 0
 		debug("c=%d x-1=%d Yb-1=%d-1=%d\n", c, x-1, xc_to_y(x, c,
 								    delta),
 		      xc_to_y(x, c, delta)-1);
@@ -631,6 +607,7 @@ diff_divide_myers_backward(bool *found_midpoint,
 			debug_dump_atom(right, left,
 				&right->atoms.head[xc_to_y(x, c, delta)-1]);
 		}
+#endif
 		x_before_slide = x;
 		while (x > 0 && xc_to_y(x, c, delta) > 0) {
 			bool same;
@@ -645,6 +622,7 @@ diff_divide_myers_backward(bool *found_midpoint,
 			x--;
 		}
 		kd_backward[c] = x;
+#if 0
 		if (x_before_slide != x) {
 			debug("  up %d similar lines\n", x_before_slide - x);
 		}
@@ -658,6 +636,7 @@ diff_divide_myers_backward(bool *found_midpoint,
 				      kd_backward[fi] - fi + delta);
 			}
 		}
+#endif
 
 		if (x < 0 || x > left->atoms.len
 		    || xc_to_y(x, c, delta) < 0
@@ -755,9 +734,6 @@ diff_divide_myers_backward(bool *found_midpoint,
 			 */
 
 			int forward_x = kd_forward[k];
-			debug("Compare:  k=%d c=%d  is (%d,%d) >= (%d,%d)?\n",
-			      k, c, forward_x, xk_to_y(forward_x, k),
-			      x, xc_to_y(x, c, delta));
 			if (forward_x >= x) {
 				if (x_before_slide != x) {
 					/* met after sliding down a mid-snake */
@@ -794,8 +770,6 @@ diff_divide_myers_backward(bool *found_midpoint,
 			}
 		}
 	}
-	debug_dump_myers_graph(left, right, NULL, kd_forward, d, kd_backward,
-			       d);
 	return 0;
 }
 
@@ -826,7 +800,6 @@ diff_algo_myers_divide(const struct diff_algo_config *
 	debug_dump(left);
 	debug("right:\n");
 	debug_dump(right);
-	debug_dump_myers_graph(left, right, NULL, NULL, 0, NULL, 0);
 
 	/* Allocate two columns of a Myers graph, one for the forward and one
 	 * for the backward traversal. */
@@ -861,7 +834,6 @@ diff_algo_myers_divide(const struct diff_algo_config *
 	bool found_midpoint = false;
 	for (d = 0; d <= (max/2); d++) {
 		int r;
-		debug("-- d=%d\n", d);
 		r = diff_divide_myers_forward(&found_midpoint, left, right,
 					      kd_forward, kd_backward, d,
 					      &mid_snake);
@@ -1153,8 +1125,6 @@ diff_algo_myers(const struct diff_algo_config *algo_co
 	int k;
 	int x, y;
 	for (d = 0; d <= max; d++, kd_column += kd_len) {
-		debug("-- d=%d\n", d);
-
 		debug("-- %s d=%d\n", __func__, d);
 
 		for (k = d; k >= -d; k -= 2) {
@@ -1180,7 +1150,6 @@ diff_algo_myers(const struct diff_algo_config *algo_co
 				continue;
 			}
 
-			debug("- k = %d\n", k);
 			if (d == 0) {
 				/* This is the initializing step. There is no
 				 * prev_k yet, get the initial x from the top
@@ -1261,15 +1230,6 @@ diff_algo_myers(const struct diff_algo_config *algo_co
 			}
 			kd_column[k] = x;
 
-			if (DEBUG) {
-				int fi;
-				for (fi = d; fi >= k; fi-=2) {
-					debug("kd_column[%d] = (%d, %d)\n", fi,
-					      kd_column[fi],
-					      kd_column[fi] - fi);
-				}
-			}
-
 			if (x == left->atoms.len
 			    && xk_to_y(x, k) == right->atoms.len) {
 				/* Found a path */