bdiff: add to clang-format oversight
authorAugie Fackler <augie@google.com>
Mon, 12 Feb 2018 10:21:44 -0500
changeset 36093 b4fdc6177b29
parent 36092 fe5c4b795999
child 36094 44cb058bc0d3
bdiff: add to clang-format oversight This file didn't require any complex fixes, so we may as well enable clang-format while I'm editing it. Differential Revision: https://phab.mercurial-scm.org/D2177
contrib/clang-format-blacklist
mercurial/cext/bdiff.c
--- a/contrib/clang-format-blacklist	Sun Feb 11 20:59:35 2018 -0500
+++ b/contrib/clang-format-blacklist	Mon Feb 12 10:21:44 2018 -0500
@@ -1,7 +1,6 @@
 # Files that just need to be migrated to the formatter.
 # Do not add new files here!
 mercurial/cext/base85.c
-mercurial/cext/bdiff.c
 mercurial/cext/charencode.c
 mercurial/cext/charencode.h
 mercurial/cext/diffhelpers.c
--- a/mercurial/cext/bdiff.c	Sun Feb 11 20:59:35 2018 -0500
+++ b/mercurial/cext/bdiff.c	Mon Feb 12 10:21:44 2018 -0500
@@ -19,7 +19,6 @@
 #include "bitmanipulation.h"
 #include "util.h"
 
-
 static PyObject *blocks(PyObject *self, PyObject *args)
 {
 	PyObject *sa, *sb, *rl = NULL, *m;
@@ -82,9 +81,7 @@
 	_save = PyEval_SaveThread();
 
 	lmax = la > lb ? lb : la;
-	for (ia = sa, ib = sb;
-	     li < lmax && *ia == *ib;
-	     ++li, ++ia, ++ib)
+	for (ia = sa, ib = sb; li < lmax && *ia == *ib; ++li, ++ia, ++ib)
 		if (*ia == '\n')
 			lcommon = li + 1;
 	/* we can almost add: if (li == lmax) lcommon = li; */
@@ -122,7 +119,8 @@
 		if (h->a1 != la || h->b1 != lb) {
 			len = bl[h->b1].l - bl[lb].l;
 			putbe32((uint32_t)(al[la].l + lcommon - al->l), rb);
-			putbe32((uint32_t)(al[h->a1].l + lcommon - al->l), rb + 4);
+			putbe32((uint32_t)(al[h->a1].l + lcommon - al->l),
+			        rb + 4);
 			putbe32((uint32_t)len, rb + 8);
 			memcpy(rb + 12, bl[lb].l, len);
 			rb += 12 + len;
@@ -167,8 +165,8 @@
 		if (c == ' ' || c == '\t' || c == '\r') {
 			if (!allws && (wlen == 0 || w[wlen - 1] != ' '))
 				w[wlen++] = ' ';
-		} else if (c == '\n' && !allws
-			  && wlen > 0 && w[wlen - 1] == ' ') {
+		} else if (c == '\n' && !allws && wlen > 0 &&
+		           w[wlen - 1] == ' ') {
 			w[wlen - 1] = '\n';
 		} else {
 			w[wlen++] = c;
@@ -182,25 +180,20 @@
 	return result ? result : PyErr_NoMemory();
 }
 
-
 static char mdiff_doc[] = "Efficient binary diff.";
 
 static PyMethodDef methods[] = {
-	{"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"},
-	{"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"},
-	{"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"},
-	{NULL, NULL}
+    {"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"},
+    {"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"},
+    {"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"},
+    {NULL, NULL},
 };
 
 static const int version = 1;
 
 #ifdef IS_PY3K
 static struct PyModuleDef bdiff_module = {
-	PyModuleDef_HEAD_INIT,
-	"bdiff",
-	mdiff_doc,
-	-1,
-	methods
+    PyModuleDef_HEAD_INIT, "bdiff", mdiff_doc, -1, methods,
 };
 
 PyMODINIT_FUNC PyInit_bdiff(void)