##// END OF EJS Templates
bdiff: re-wrap lines per clang-format...
Augie Fackler -
r34631:38463bd9 default
parent child Browse files
Show More
@@ -79,7 +79,8 b' int bdiff_splitlines(const char *a, ssiz'
79
79
80 static inline int cmp(struct bdiff_line *a, struct bdiff_line *b)
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 || memcmp(a->l, b->l, a->len);
82 return a->hash != b->hash || a->len != b->len ||
83 memcmp(a->l, b->l, a->len);
83 }
84 }
84
85
85 static int equatelines(struct bdiff_line *a, int an, struct bdiff_line *b,
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 /* expand match to include subsequent popular lines */
214 /* expand match to include subsequent popular lines */
214 while (mi + mk < a2 && mj + mk < b2 &&
215 while (mi + mk < a2 && mj + mk < b2 && a[mi + mk].e == b[mj + mk].e)
215 a[mi + mk].e == b[mj + mk].e)
216 mk++;
216 mk++;
217
217
218 *omi = mi;
218 *omi = mi;
@@ -238,7 +238,8 b' static struct bdiff_hunk *recurse(struct'
238 if (!l)
238 if (!l)
239 return NULL;
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 if (!l->next)
243 if (!l->next)
243 return NULL;
244 return NULL;
244
245
@@ -274,7 +275,8 b' int bdiff_diff(struct bdiff_line *a, int'
274 return -1;
275 return -1;
275
276
276 /* sentinel end hunk */
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 if (!curr->next)
280 if (!curr->next)
279 return -1;
281 return -1;
280 curr = curr->next;
282 curr = curr->next;
@@ -293,10 +295,9 b' int bdiff_diff(struct bdiff_line *a, int'
293 break;
295 break;
294
296
295 if (curr->a2 == next->a1 || curr->b2 == next->b1)
297 if (curr->a2 == next->a1 || curr->b2 == next->b1)
296 while (curr->a2 < an && curr->b2 < bn
298 while (curr->a2 < an && curr->b2 < bn &&
297 && next->a1 < next->a2
299 next->a1 < next->a2 && next->b1 < next->b2 &&
298 && next->b1 < next->b2
300 !cmp(a + curr->a2, b + curr->b2)) {
299 && !cmp(a + curr->a2, b + curr->b2)) {
300 curr->a2++;
301 curr->a2++;
301 next->a1++;
302 next->a1++;
302 curr->b2++;
303 curr->b2++;
General Comments 0
You need to be logged in to leave comments. Login now