##// END OF EJS Templates
mpatch: allow clang-format oversight...
Augie Fackler -
r36245:69080ee1 default
parent child Browse files
Show More
@@ -2,7 +2,6 b''
2 2 # Do not add new files here!
3 3 mercurial/cext/dirs.c
4 4 mercurial/cext/manifest.c
5 mercurial/cext/mpatch.c
6 5 mercurial/cext/osutil.c
7 6 mercurial/cext/revlog.c
8 7 # Vendored code that we should never format:
@@ -55,10 +55,10 b' struct mpatch_flist *cpygetitem(void *bi'
55 55 ssize_t blen;
56 56 int r;
57 57
58 PyObject *tmp = PyList_GetItem((PyObject*)bins, pos);
58 PyObject *tmp = PyList_GetItem((PyObject *)bins, pos);
59 59 if (!tmp)
60 60 return NULL;
61 if (PyObject_AsCharBuffer(tmp, &buffer, (Py_ssize_t*)&blen))
61 if (PyObject_AsCharBuffer(tmp, &buffer, (Py_ssize_t *)&blen))
62 62 return NULL;
63 63 if ((r = mpatch_decode(buffer, blen, &res)) < 0) {
64 64 if (!PyErr_Occurred())
@@ -68,8 +68,7 b' struct mpatch_flist *cpygetitem(void *bi'
68 68 return res;
69 69 }
70 70
71 static PyObject *
72 patches(PyObject *self, PyObject *args)
71 static PyObject *patches(PyObject *self, PyObject *args)
73 72 {
74 73 PyObject *text, *bins, *result;
75 74 struct mpatch_flist *patch;
@@ -123,8 +122,7 b' cleanup:'
123 122 }
124 123
125 124 /* calculate size of a patched file directly */
126 static PyObject *
127 patchedsize(PyObject *self, PyObject *args)
125 static PyObject *patchedsize(PyObject *self, PyObject *args)
128 126 {
129 127 long orig, start, end, len, outlen = 0, last = 0, pos = 0;
130 128 Py_ssize_t patchlen;
@@ -147,7 +145,8 b' patchedsize(PyObject *self, PyObject *ar'
147 145
148 146 if (pos != patchlen) {
149 147 if (!PyErr_Occurred())
150 PyErr_SetString(mpatch_Error, "patch cannot be decoded");
148 PyErr_SetString(mpatch_Error,
149 "patch cannot be decoded");
151 150 return NULL;
152 151 }
153 152
@@ -156,20 +155,16 b' patchedsize(PyObject *self, PyObject *ar'
156 155 }
157 156
158 157 static PyMethodDef methods[] = {
159 {"patches", patches, METH_VARARGS, "apply a series of patches\n"},
160 {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"},
161 {NULL, NULL}
158 {"patches", patches, METH_VARARGS, "apply a series of patches\n"},
159 {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"},
160 {NULL, NULL},
162 161 };
163 162
164 163 static const int version = 1;
165 164
166 165 #ifdef IS_PY3K
167 166 static struct PyModuleDef mpatch_module = {
168 PyModuleDef_HEAD_INIT,
169 "mpatch",
170 mpatch_doc,
171 -1,
172 methods
167 PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods,
173 168 };
174 169
175 170 PyMODINIT_FUNC PyInit_mpatch(void)
@@ -180,8 +175,8 b' PyMODINIT_FUNC PyInit_mpatch(void)'
180 175 if (m == NULL)
181 176 return NULL;
182 177
183 mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
184 NULL, NULL);
178 mpatch_Error =
179 PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL);
185 180 Py_INCREF(mpatch_Error);
186 181 PyModule_AddObject(m, "mpatchError", mpatch_Error);
187 182 PyModule_AddIntConstant(m, "version", version);
@@ -189,13 +184,12 b' PyMODINIT_FUNC PyInit_mpatch(void)'
189 184 return m;
190 185 }
191 186 #else
192 PyMODINIT_FUNC
193 initmpatch(void)
187 PyMODINIT_FUNC initmpatch(void)
194 188 {
195 189 PyObject *m;
196 190 m = Py_InitModule3("mpatch", methods, mpatch_doc);
197 mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
198 NULL, NULL);
191 mpatch_Error =
192 PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL);
199 193 PyModule_AddIntConstant(m, "version", version);
200 194 }
201 195 #endif
General Comments 0
You need to be logged in to leave comments. Login now