##// END OF EJS Templates
bdiff: fold in shift calculation in normalize...
Matt Mackall -
r29011:8bcda4c7 stable
parent child Browse files
Show More
@@ -259,22 +259,18 b' static int diff(struct line *a, int an, '
259 /* normalize the hunk list, try to push each hunk towards the end */
259 /* normalize the hunk list, try to push each hunk towards the end */
260 for (curr = base->next; curr; curr = curr->next) {
260 for (curr = base->next; curr; curr = curr->next) {
261 struct hunk *next = curr->next;
261 struct hunk *next = curr->next;
262 int shift = 0;
263
262
264 if (!next)
263 if (!next)
265 break;
264 break;
266
265
267 if (curr->a2 == next->a1 || curr->b2 == next->b1)
266 if (curr->a2 == next->a1 || curr->b2 == next->b1)
268 while (curr->a2 + shift < an && curr->b2 + shift < bn
267 while (curr->a2 < an && curr->b2 < bn
269 && !cmp(a + curr->a2 + shift,
268 && !cmp(a + curr->a2, b + curr->b2)) {
270 b + curr->b2 + shift))
269 curr->a2++;
271 shift++;
270 next->a1++;
272 if (!shift)
271 curr->b2++;
273 continue;
272 next->b1++;
274 curr->b2 += shift;
273 }
275 next->b1 += shift;
276 curr->a2 += shift;
277 next->a1 += shift;
278 }
274 }
279
275
280 for (curr = base->next; curr; curr = curr->next)
276 for (curr = base->next; curr; curr = curr->next)
General Comments 0
You need to be logged in to leave comments. Login now