Show More
@@ -79,7 +79,8 b' int bdiff_splitlines(const char *a, ssiz' | |||
|
79 | 79 | |
|
80 | 80 | static inline int cmp(struct bdiff_line *a, struct bdiff_line *b) |
|
81 | 81 | { |
|
82 |
return a->hash != b->hash || a->len != b->len || |
|
|
82 | return a->hash != b->hash || a->len != b->len || | |
|
83 | memcmp(a->l, b->l, a->len); | |
|
83 | 84 | } |
|
84 | 85 | |
|
85 | 86 | static int equatelines(struct bdiff_line *a, int an, struct bdiff_line *b, |
@@ -211,8 +212,7 b' static int longest_match(struct bdiff_li' | |||
|
211 | 212 | } |
|
212 | 213 | |
|
213 | 214 | /* expand match to include subsequent popular lines */ |
|
214 | while (mi + mk < a2 && mj + mk < b2 && | |
|
215 | a[mi + mk].e == b[mj + mk].e) | |
|
215 | while (mi + mk < a2 && mj + mk < b2 && a[mi + mk].e == b[mj + mk].e) | |
|
216 | 216 | mk++; |
|
217 | 217 | |
|
218 | 218 | *omi = mi; |
@@ -238,7 +238,8 b' static struct bdiff_hunk *recurse(struct' | |||
|
238 | 238 | if (!l) |
|
239 | 239 | return NULL; |
|
240 | 240 | |
|
241 | l->next = (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); | |
|
241 | l->next = | |
|
242 | (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); | |
|
242 | 243 | if (!l->next) |
|
243 | 244 | return NULL; |
|
244 | 245 | |
@@ -274,7 +275,8 b' int bdiff_diff(struct bdiff_line *a, int' | |||
|
274 | 275 | return -1; |
|
275 | 276 | |
|
276 | 277 | /* sentinel end hunk */ |
|
277 | curr->next = (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); | |
|
278 | curr->next = | |
|
279 | (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); | |
|
278 | 280 | if (!curr->next) |
|
279 | 281 | return -1; |
|
280 | 282 | curr = curr->next; |
@@ -293,10 +295,9 b' int bdiff_diff(struct bdiff_line *a, int' | |||
|
293 | 295 | break; |
|
294 | 296 | |
|
295 | 297 | if (curr->a2 == next->a1 || curr->b2 == next->b1) |
|
296 | while (curr->a2 < an && curr->b2 < bn | |
|
297 |
|
|
|
298 | && next->b1 < next->b2 | |
|
299 | && !cmp(a + curr->a2, b + curr->b2)) { | |
|
298 | while (curr->a2 < an && curr->b2 < bn && | |
|
299 | next->a1 < next->a2 && next->b1 < next->b2 && | |
|
300 | !cmp(a + curr->a2, b + curr->b2)) { | |
|
300 | 301 | curr->a2++; |
|
301 | 302 | next->a1++; |
|
302 | 303 | curr->b2++; |
General Comments 0
You need to be logged in to leave comments.
Login now