##// END OF EJS Templates
dirs: give formatting oversight to clang-format...
Augie Fackler -
r43507:ea62d7b0 default
parent child Browse files
Show More
@@ -1,6 +1,5 b''
1 # Files that just need to be migrated to the formatter.
1 # Files that just need to be migrated to the formatter.
2 # Do not add new files here!
2 # Do not add new files here!
3 mercurial/cext/dirs.c
4 mercurial/cext/manifest.c
3 mercurial/cext/manifest.c
5 mercurial/cext/osutil.c
4 mercurial/cext/osutil.c
6 # Vendored code that we should never format:
5 # Vendored code that we should never format:
@@ -42,7 +42,7 b' static inline Py_ssize_t _finddir(const '
42 pos -= 1;
42 pos -= 1;
43 }
43 }
44 if (pos == -1) {
44 if (pos == -1) {
45 return 0;
45 return 0;
46 }
46 }
47
47
48 return pos;
48 return pos;
@@ -56,13 +56,13 b' static int _addpath(PyObject *dirs, PyOb'
56 int ret = -1;
56 int ret = -1;
57
57
58 /* This loop is super critical for performance. That's why we inline
58 /* This loop is super critical for performance. That's why we inline
59 * access to Python structs instead of going through a supported API.
59 * access to Python structs instead of going through a supported API.
60 * The implementation, therefore, is heavily dependent on CPython
60 * The implementation, therefore, is heavily dependent on CPython
61 * implementation details. We also commit violations of the Python
61 * implementation details. We also commit violations of the Python
62 * "protocol" such as mutating immutable objects. But since we only
62 * "protocol" such as mutating immutable objects. But since we only
63 * mutate objects created in this function or in other well-defined
63 * mutate objects created in this function or in other well-defined
64 * locations, the references are known so these violations should go
64 * locations, the references are known so these violations should go
65 * unnoticed. */
65 * unnoticed. */
66 while ((pos = _finddir(cpath, pos - 1)) != -1) {
66 while ((pos = _finddir(cpath, pos - 1)) != -1) {
67 PyObject *val;
67 PyObject *val;
68
68
@@ -120,7 +120,7 b' static int _delpath(PyObject *dirs, PyOb'
120 val = PyDict_GetItem(dirs, key);
120 val = PyDict_GetItem(dirs, key);
121 if (val == NULL) {
121 if (val == NULL) {
122 PyErr_SetString(PyExc_ValueError,
122 PyErr_SetString(PyExc_ValueError,
123 "expected a value, found none");
123 "expected a value, found none");
124 goto bail;
124 goto bail;
125 }
125 }
126
126
@@ -152,7 +152,7 b' static int dirs_fromdict(PyObject *dirs,'
152 if (skipchar) {
152 if (skipchar) {
153 if (!dirstate_tuple_check(value)) {
153 if (!dirstate_tuple_check(value)) {
154 PyErr_SetString(PyExc_TypeError,
154 PyErr_SetString(PyExc_TypeError,
155 "expected a dirstate tuple");
155 "expected a dirstate tuple");
156 return -1;
156 return -1;
157 }
157 }
158 if (((dirstateTupleObject *)value)->state == skipchar)
158 if (((dirstateTupleObject *)value)->state == skipchar)
@@ -218,8 +218,8 b' static int dirs_init(dirsObject *self, P'
218 ret = dirs_fromdict(dirs, source, skipchar);
218 ret = dirs_fromdict(dirs, source, skipchar);
219 else if (skipchar)
219 else if (skipchar)
220 PyErr_SetString(PyExc_ValueError,
220 PyErr_SetString(PyExc_ValueError,
221 "skip character is only supported "
221 "skip character is only supported "
222 "with a dict source");
222 "with a dict source");
223 else
223 else
224 ret = dirs_fromiter(dirs, source);
224 ret = dirs_fromiter(dirs, source);
225
225
@@ -276,12 +276,12 b' static PyObject *dirs_iter(dirsObject *s'
276 static PySequenceMethods dirs_sequence_methods;
276 static PySequenceMethods dirs_sequence_methods;
277
277
278 static PyMethodDef dirs_methods[] = {
278 static PyMethodDef dirs_methods[] = {
279 {"addpath", (PyCFunction)dirs_addpath, METH_VARARGS, "add a path"},
279 {"addpath", (PyCFunction)dirs_addpath, METH_VARARGS, "add a path"},
280 {"delpath", (PyCFunction)dirs_delpath, METH_VARARGS, "remove a path"},
280 {"delpath", (PyCFunction)dirs_delpath, METH_VARARGS, "remove a path"},
281 {NULL} /* Sentinel */
281 {NULL} /* Sentinel */
282 };
282 };
283
283
284 static PyTypeObject dirsType = { PyVarObject_HEAD_INIT(NULL, 0) };
284 static PyTypeObject dirsType = {PyVarObject_HEAD_INIT(NULL, 0)};
285
285
286 void dirs_module_init(PyObject *mod)
286 void dirs_module_init(PyObject *mod)
287 {
287 {
General Comments 0
You need to be logged in to leave comments. Login now