Show More
@@ -222,21 +222,28 b' static void lmiter_dealloc(PyObject *o)' | |||||
222 | PyObject_Del(self); |
|
222 | PyObject_Del(self); | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
|
225 | static line *lmiter_nextline(lmIter *self) | |||
|
226 | { | |||
|
227 | do { | |||
|
228 | self->pos++; | |||
|
229 | if (self->pos >= self->m->numlines) { | |||
|
230 | return NULL; | |||
|
231 | } | |||
|
232 | /* skip over deleted manifest entries */ | |||
|
233 | } while (self->m->lines[self->pos].deleted); | |||
|
234 | return self->m->lines + self->pos; | |||
|
235 | } | |||
|
236 | ||||
225 | static PyObject *lmiter_iternext(PyObject *o) |
|
237 | static PyObject *lmiter_iternext(PyObject *o) | |
226 | { |
|
238 | { | |
227 | size_t pl; |
|
239 | size_t pl; | |
228 | line *l; |
|
240 | line *l; | |
229 | Py_ssize_t consumed; |
|
241 | Py_ssize_t consumed; | |
230 |
PyObject |
|
242 | PyObject *path = NULL, *hash = NULL, *flags = NULL; | |
231 |
l |
|
243 | l = lmiter_nextline((lmIter *)o); | |
232 | do { |
|
244 | if (!l) { | |
233 | self->pos++; |
|
245 | goto bail; | |
234 | if (self->pos >= self->m->numlines) { |
|
246 | } | |
235 | goto bail; |
|
|||
236 | } |
|
|||
237 | /* skip over deleted manifest entries */ |
|
|||
238 | } while (self->m->lines[self->pos].deleted); |
|
|||
239 | l = self->m->lines + self->pos; |
|
|||
240 | pl = pathlen(l); |
|
247 | pl = pathlen(l); | |
241 | path = PyString_FromStringAndSize(l->start, pl); |
|
248 | path = PyString_FromStringAndSize(l->start, pl); | |
242 | hash = nodeof(l); |
|
249 | hash = nodeof(l); | |
@@ -246,12 +253,12 b' static PyObject *lmiter_iternext(PyObjec' | |||||
246 | if (!path || !hash || !flags) { |
|
253 | if (!path || !hash || !flags) { | |
247 | goto bail; |
|
254 | goto bail; | |
248 | } |
|
255 | } | |
249 |
ret |
|
256 | return PyTuple_Pack(3, path, hash, flags); | |
250 | bail: |
|
257 | bail: | |
251 | Py_XDECREF(path); |
|
258 | Py_XDECREF(path); | |
252 | Py_XDECREF(hash); |
|
259 | Py_XDECREF(hash); | |
253 | Py_XDECREF(flags); |
|
260 | Py_XDECREF(flags); | |
254 |
return |
|
261 | return NULL; | |
255 | } |
|
262 | } | |
256 |
|
263 | |||
257 | static PyTypeObject lazymanifestIterator = { |
|
264 | static PyTypeObject lazymanifestIterator = { |
General Comments 0
You need to be logged in to leave comments.
Login now