##// END OF EJS Templates
diffhelpers: allow clang-format oversight...
Augie Fackler -
r36074:7f8338b8 default
parent child Browse files
Show More
@@ -3,7 +3,6 b''
3 mercurial/cext/base85.c
3 mercurial/cext/base85.c
4 mercurial/cext/charencode.c
4 mercurial/cext/charencode.c
5 mercurial/cext/charencode.h
5 mercurial/cext/charencode.h
6 mercurial/cext/diffhelpers.c
7 mercurial/cext/dirs.c
6 mercurial/cext/dirs.c
8 mercurial/cext/manifest.c
7 mercurial/cext/manifest.c
9 mercurial/cext/mpatch.c
8 mercurial/cext/mpatch.c
@@ -16,7 +16,6 b''
16 static char diffhelpers_doc[] = "Efficient diff parsing";
16 static char diffhelpers_doc[] = "Efficient diff parsing";
17 static PyObject *diffhelpers_Error;
17 static PyObject *diffhelpers_Error;
18
18
19
20 /* fixup the last lines of a and b when the patch has no newline at eof */
19 /* fixup the last lines of a and b when the patch has no newline at eof */
21 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b)
20 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b)
22 {
21 {
@@ -50,8 +49,7 b' static void _fix_newline(PyObject *hunk,'
50 }
49 }
51
50
52 /* python callable form of _fix_newline */
51 /* python callable form of _fix_newline */
53 static PyObject *
52 static PyObject *fix_newline(PyObject *self, PyObject *args)
54 fix_newline(PyObject *self, PyObject *args)
55 {
53 {
56 PyObject *hunk, *a, *b;
54 PyObject *hunk, *a, *b;
57 if (!PyArg_ParseTuple(args, "OOO", &hunk, &a, &b))
55 if (!PyArg_ParseTuple(args, "OOO", &hunk, &a, &b))
@@ -72,8 +70,7 b' static const char *addlines_format = "OO'
72 * The control char from the hunk is saved when inserting into a, but not b
70 * The control char from the hunk is saved when inserting into a, but not b
73 * (for performance while deleting files)
71 * (for performance while deleting files)
74 */
72 */
75 static PyObject *
73 static PyObject *addlines(PyObject *self, PyObject *args)
76 addlines(PyObject *self, PyObject *args)
77 {
74 {
78
75
79 PyObject *fp, *hunk, *a, *b, *x;
76 PyObject *fp, *hunk, *a, *b, *x;
@@ -83,8 +80,8 b' addlines(PyObject *self, PyObject *args)'
83 Py_ssize_t todoa, todob;
80 Py_ssize_t todoa, todob;
84 char *s, c;
81 char *s, c;
85 PyObject *l;
82 PyObject *l;
86 if (!PyArg_ParseTuple(args, addlines_format,
83 if (!PyArg_ParseTuple(args, addlines_format, &fp, &hunk, &lena, &lenb,
87 &fp, &hunk, &lena, &lenb, &a, &b))
84 &a, &b))
88 return NULL;
85 return NULL;
89
86
90 while (1) {
87 while (1) {
@@ -131,8 +128,7 b' addlines(PyObject *self, PyObject *args)'
131 * a control char at the start of each line, this char is ignored in the
128 * a control char at the start of each line, this char is ignored in the
132 * compare
129 * compare
133 */
130 */
134 static PyObject *
131 static PyObject *testhunk(PyObject *self, PyObject *args)
135 testhunk(PyObject *self, PyObject *args)
136 {
132 {
137
133
138 PyObject *a, *b;
134 PyObject *a, *b;
@@ -161,18 +157,13 b' static PyMethodDef methods[] = {'
161 {"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"},
157 {"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"},
162 {"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"},
158 {"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"},
163 {"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"},
159 {"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"},
164 {NULL, NULL}
160 {NULL, NULL}};
165 };
166
161
167 static const int version = 1;
162 static const int version = 1;
168
163
169 #ifdef IS_PY3K
164 #ifdef IS_PY3K
170 static struct PyModuleDef diffhelpers_module = {
165 static struct PyModuleDef diffhelpers_module = {
171 PyModuleDef_HEAD_INIT,
166 PyModuleDef_HEAD_INIT, "diffhelpers", diffhelpers_doc, -1, methods,
172 "diffhelpers",
173 diffhelpers_doc,
174 -1,
175 methods
176 };
167 };
177
168
178 PyMODINIT_FUNC PyInit_diffhelpers(void)
169 PyMODINIT_FUNC PyInit_diffhelpers(void)
@@ -183,8 +174,8 b' PyMODINIT_FUNC PyInit_diffhelpers(void)'
183 if (m == NULL)
174 if (m == NULL)
184 return NULL;
175 return NULL;
185
176
186 diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
177 diffhelpers_Error =
187 NULL, NULL);
178 PyErr_NewException("diffhelpers.diffhelpersError", NULL, NULL);
188 Py_INCREF(diffhelpers_Error);
179 Py_INCREF(diffhelpers_Error);
189 PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error);
180 PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error);
190 PyModule_AddIntConstant(m, "version", version);
181 PyModule_AddIntConstant(m, "version", version);
@@ -192,13 +183,12 b' PyMODINIT_FUNC PyInit_diffhelpers(void)'
192 return m;
183 return m;
193 }
184 }
194 #else
185 #else
195 PyMODINIT_FUNC
186 PyMODINIT_FUNC initdiffhelpers(void)
196 initdiffhelpers(void)
197 {
187 {
198 PyObject *m;
188 PyObject *m;
199 m = Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
189 m = Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
200 diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
190 diffhelpers_Error =
201 NULL, NULL);
191 PyErr_NewException("diffhelpers.diffhelpersError", NULL, NULL);
202 PyModule_AddIntConstant(m, "version", version);
192 PyModule_AddIntConstant(m, "version", version);
203 }
193 }
204 #endif
194 #endif
General Comments 0
You need to be logged in to leave comments. Login now