From patchwork Wed Oct 11 15:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D1007: bdiff: re-wrap lines per clang-format From: phabricator X-Patchwork-Id: 24744 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Wed, 11 Oct 2017 15:00:08 +0000 durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY A few too-wide lines corrected, and some places where clang-format prefers to wrap after the binary operator instead of before. I don't feel strongly, so I'm leaving the auto-format result as "after the binary operator". REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1007 AFFECTED FILES mercurial/bdiff.c CHANGE DETAILS To: durin42, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -79,7 +79,8 @@ static inline int cmp(struct bdiff_line *a, struct bdiff_line *b) { - return a->hash != b->hash || a->len != b->len || memcmp(a->l, b->l, a->len); + return a->hash != b->hash || a->len != b->len || + memcmp(a->l, b->l, a->len); } static int equatelines(struct bdiff_line *a, int an, struct bdiff_line *b, @@ -211,8 +212,7 @@ } /* expand match to include subsequent popular lines */ - while (mi + mk < a2 && mj + mk < b2 && - a[mi + mk].e == b[mj + mk].e) + while (mi + mk < a2 && mj + mk < b2 && a[mi + mk].e == b[mj + mk].e) mk++; *omi = mi; @@ -238,7 +238,8 @@ if (!l) return NULL; - l->next = (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); + l->next = + (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); if (!l->next) return NULL; @@ -274,7 +275,8 @@ return -1; /* sentinel end hunk */ - curr->next = (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); + curr->next = + (struct bdiff_hunk *)malloc(sizeof(struct bdiff_hunk)); if (!curr->next) return -1; curr = curr->next; @@ -293,10 +295,9 @@ break; if (curr->a2 == next->a1 || curr->b2 == next->b1) - while (curr->a2 < an && curr->b2 < bn - && next->a1 < next->a2 - && next->b1 < next->b2 - && !cmp(a + curr->a2, b + curr->b2)) { + while (curr->a2 < an && curr->b2 < bn && + next->a1 < next->a2 && next->b1 < next->b2 && + !cmp(a + curr->a2, b + curr->b2)) { curr->a2++; next->a1++; curr->b2++;