Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/osutil.c @ 5416:ca890c0c3f1f
osutil.c: style fix - delete trailing end-of-line spaces
author | Giorgos Keramidas <keramida@ceid.upatras.gr> |
---|---|
date | Sun, 07 Oct 2007 21:56:36 +0300 |
parents | ecde0b7e0b3f |
children | 9b5d626be8ba |
comparison
equal
deleted
inserted
replaced
5415:1d53a75ea0fc | 5416:ca890c0c3f1f |
---|---|
119 char *full_path; | 119 char *full_path; |
120 int path_len; | 120 int path_len; |
121 int do_stat; | 121 int do_stat; |
122 char *path; | 122 char *path; |
123 int ret; | 123 int ret; |
124 | 124 |
125 { | 125 { |
126 static char *kwlist[] = { "path", "stat", NULL }; | 126 static char *kwlist[] = { "path", "stat", NULL }; |
127 PyObject *statobj = NULL; | 127 PyObject *statobj = NULL; |
128 | 128 |
129 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:listdir", kwlist, | 129 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:listdir", kwlist, |
130 &path, &path_len, &statobj)) | 130 &path, &path_len, &statobj)) |
131 goto bail; | 131 goto bail; |
132 | 132 |
133 do_stat = statobj && PyObject_IsTrue(statobj); | 133 do_stat = statobj && PyObject_IsTrue(statobj); |
134 } | 134 } |
135 | 135 |
136 if ((dir = opendir(path)) == NULL) { | 136 if ((dir = opendir(path)) == NULL) { |
137 list = PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); | 137 list = PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); |
138 goto bail; | 138 goto bail; |
139 } | 139 } |
140 | 140 |
185 py_kind = PyInt_FromLong(kind); | 185 py_kind = PyInt_FromLong(kind); |
186 else { | 186 else { |
187 py_kind = Py_None; | 187 py_kind = Py_None; |
188 Py_INCREF(Py_None); | 188 Py_INCREF(Py_None); |
189 } | 189 } |
190 | 190 |
191 val = PyTuple_New(do_stat ? 3 : 2); | 191 val = PyTuple_New(do_stat ? 3 : 2); |
192 | 192 |
193 if (name == NULL || py_kind == NULL || val == NULL) { | 193 if (name == NULL || py_kind == NULL || val == NULL) { |
194 Py_XDECREF(name); | 194 Py_XDECREF(name); |
195 Py_XDECREF(py_kind); | 195 Py_XDECREF(py_kind); |
196 Py_XDECREF(val); | 196 Py_XDECREF(val); |
197 | 197 |
206 } | 206 } |
207 | 207 |
208 PyList_Append(list, val); | 208 PyList_Append(list, val); |
209 Py_DECREF(val); | 209 Py_DECREF(val); |
210 } | 210 } |
211 | 211 |
212 PyList_Sort(list); | 212 PyList_Sort(list); |
213 | 213 |
214 if (do_stat || !all_kinds) { | 214 if (do_stat || !all_kinds) { |
215 ssize_t size = PyList_Size(list); | 215 ssize_t size = PyList_Size(list); |
216 ssize_t i; | 216 ssize_t i; |
224 PyObject *py_st = NULL; | 224 PyObject *py_st = NULL; |
225 PyObject *py_kind = PyTuple_GET_ITEM(elt, 1); | 225 PyObject *py_kind = PyTuple_GET_ITEM(elt, 1); |
226 int kind; | 226 int kind; |
227 | 227 |
228 kind = py_kind == Py_None ? -1 : PyInt_AsLong(py_kind); | 228 kind = py_kind == Py_None ? -1 : PyInt_AsLong(py_kind); |
229 | 229 |
230 if (kind != -1 && !do_stat) | 230 if (kind != -1 && !do_stat) |
231 continue; | 231 continue; |
232 | 232 |
233 strcpy(full_path + path_len + 1, name); | 233 strcpy(full_path + path_len + 1, name); |
234 | 234 |
238 if (ctor_args == NULL) { | 238 if (ctor_args == NULL) { |
239 ctor_args = PyTuple_New(0); | 239 ctor_args = PyTuple_New(0); |
240 if (ctor_args == NULL) | 240 if (ctor_args == NULL) |
241 goto bail; | 241 goto bail; |
242 } | 242 } |
243 | 243 |
244 st = (struct listdir_stat *) | 244 st = (struct listdir_stat *) |
245 PyObject_CallObject((PyObject *) &listdir_stat_type, | 245 PyObject_CallObject((PyObject *) &listdir_stat_type, |
246 ctor_args); | 246 ctor_args); |
247 if (st == NULL) | 247 if (st == NULL) |
248 goto bail; | 248 goto bail; |