mercurial/cext/mpatch.c
changeset 36227 69080ee1fb0e
parent 35941 3028a3215a2e
child 36361 a2d11d23bb25
--- a/mercurial/cext/mpatch.c	Mon Feb 12 10:39:46 2018 -0500
+++ b/mercurial/cext/mpatch.c	Mon Feb 12 10:41:00 2018 -0500
@@ -55,10 +55,10 @@
 	ssize_t blen;
 	int r;
 
-	PyObject *tmp = PyList_GetItem((PyObject*)bins, pos);
+	PyObject *tmp = PyList_GetItem((PyObject *)bins, pos);
 	if (!tmp)
 		return NULL;
-	if (PyObject_AsCharBuffer(tmp, &buffer, (Py_ssize_t*)&blen))
+	if (PyObject_AsCharBuffer(tmp, &buffer, (Py_ssize_t *)&blen))
 		return NULL;
 	if ((r = mpatch_decode(buffer, blen, &res)) < 0) {
 		if (!PyErr_Occurred())
@@ -68,8 +68,7 @@
 	return res;
 }
 
-static PyObject *
-patches(PyObject *self, PyObject *args)
+static PyObject *patches(PyObject *self, PyObject *args)
 {
 	PyObject *text, *bins, *result;
 	struct mpatch_flist *patch;
@@ -123,8 +122,7 @@
 }
 
 /* calculate size of a patched file directly */
-static PyObject *
-patchedsize(PyObject *self, PyObject *args)
+static PyObject *patchedsize(PyObject *self, PyObject *args)
 {
 	long orig, start, end, len, outlen = 0, last = 0, pos = 0;
 	Py_ssize_t patchlen;
@@ -147,7 +145,8 @@
 
 	if (pos != patchlen) {
 		if (!PyErr_Occurred())
-			PyErr_SetString(mpatch_Error, "patch cannot be decoded");
+			PyErr_SetString(mpatch_Error,
+			                "patch cannot be decoded");
 		return NULL;
 	}
 
@@ -156,20 +155,16 @@
 }
 
 static PyMethodDef methods[] = {
-	{"patches", patches, METH_VARARGS, "apply a series of patches\n"},
-	{"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"},
-	{NULL, NULL}
+    {"patches", patches, METH_VARARGS, "apply a series of patches\n"},
+    {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"},
+    {NULL, NULL},
 };
 
 static const int version = 1;
 
 #ifdef IS_PY3K
 static struct PyModuleDef mpatch_module = {
-	PyModuleDef_HEAD_INIT,
-	"mpatch",
-	mpatch_doc,
-	-1,
-	methods
+    PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods,
 };
 
 PyMODINIT_FUNC PyInit_mpatch(void)
@@ -180,8 +175,8 @@
 	if (m == NULL)
 		return NULL;
 
-	mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
-					  NULL, NULL);
+	mpatch_Error =
+	    PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL);
 	Py_INCREF(mpatch_Error);
 	PyModule_AddObject(m, "mpatchError", mpatch_Error);
 	PyModule_AddIntConstant(m, "version", version);
@@ -189,13 +184,12 @@
 	return m;
 }
 #else
-PyMODINIT_FUNC
-initmpatch(void)
+PyMODINIT_FUNC initmpatch(void)
 {
 	PyObject *m;
 	m = Py_InitModule3("mpatch", methods, mpatch_doc);
-	mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
-					  NULL, NULL);
+	mpatch_Error =
+	    PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL);
 	PyModule_AddIntConstant(m, "version", version);
 }
 #endif