Patchwork D1007: bdiff: re-wrap lines per clang-format

login
register
mail settings
Submitter phabricator
Date Oct. 11, 2017, 3 p.m.
Message ID <differential-rev-PHID-DREV-jmnm4j5ncxdue5gvhi5k-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24744/
State Accepted
Headers show

Comments

phabricator - Oct. 11, 2017, 3 p.m.
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

Patch

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++;