292 0, /* tp_weaklistoffset */ |
292 0, /* tp_weaklistoffset */ |
293 PyObject_SelfIter, /* tp_iter: __iter__() method */ |
293 PyObject_SelfIter, /* tp_iter: __iter__() method */ |
294 lmiter_iternext, /* tp_iternext: next() method */ |
294 lmiter_iternext, /* tp_iternext: next() method */ |
295 }; |
295 }; |
296 |
296 |
|
297 static PyObject *lmiter_iterkeysnext(PyObject *o) |
|
298 { |
|
299 size_t pl; |
|
300 line *l = lmiter_nextline((lmIter *)o); |
|
301 if (!l) { |
|
302 return NULL; |
|
303 } |
|
304 pl = pathlen(l); |
|
305 return PyString_FromStringAndSize(l->start, pl); |
|
306 } |
|
307 |
|
308 static PyTypeObject lazymanifestKeysIterator = { |
|
309 PyObject_HEAD_INIT(NULL) |
|
310 0, /*ob_size */ |
|
311 "parsers.lazymanifest.keysiterator", /*tp_name */ |
|
312 sizeof(lmIter), /*tp_basicsize */ |
|
313 0, /*tp_itemsize */ |
|
314 lmiter_dealloc, /*tp_dealloc */ |
|
315 0, /*tp_print */ |
|
316 0, /*tp_getattr */ |
|
317 0, /*tp_setattr */ |
|
318 0, /*tp_compare */ |
|
319 0, /*tp_repr */ |
|
320 0, /*tp_as_number */ |
|
321 0, /*tp_as_sequence */ |
|
322 0, /*tp_as_mapping */ |
|
323 0, /*tp_hash */ |
|
324 0, /*tp_call */ |
|
325 0, /*tp_str */ |
|
326 0, /*tp_getattro */ |
|
327 0, /*tp_setattro */ |
|
328 0, /*tp_as_buffer */ |
|
329 /* tp_flags: Py_TPFLAGS_HAVE_ITER tells python to |
|
330 use tp_iter and tp_iternext fields. */ |
|
331 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, |
|
332 "Keys iterator for a lazymanifest.", /* tp_doc */ |
|
333 0, /* tp_traverse */ |
|
334 0, /* tp_clear */ |
|
335 0, /* tp_richcompare */ |
|
336 0, /* tp_weaklistoffset */ |
|
337 PyObject_SelfIter, /* tp_iter: __iter__() method */ |
|
338 lmiter_iterkeysnext, /* tp_iternext: next() method */ |
|
339 }; |
|
340 |
297 static lazymanifest *lazymanifest_copy(lazymanifest *self); |
341 static lazymanifest *lazymanifest_copy(lazymanifest *self); |
298 |
342 |
299 static PyObject *lazymanifest_getiter(lazymanifest *self) |
343 static PyObject *lazymanifest_getiter(lazymanifest *self) |
300 { |
344 { |
301 lmIter *i = NULL; |
345 lmIter *i = NULL; |
793 Py_XDECREF(emptyTup); |
856 Py_XDECREF(emptyTup); |
794 return NULL; |
857 return NULL; |
795 } |
858 } |
796 |
859 |
797 static PyMethodDef lazymanifest_methods[] = { |
860 static PyMethodDef lazymanifest_methods[] = { |
|
861 {"iterkeys", (PyCFunction)lazymanifest_getkeysiter, METH_NOARGS, |
|
862 "Iterate over file names in this lazymanifest."}, |
798 {"copy", (PyCFunction)lazymanifest_copy, METH_NOARGS, |
863 {"copy", (PyCFunction)lazymanifest_copy, METH_NOARGS, |
799 "Make a copy of this lazymanifest."}, |
864 "Make a copy of this lazymanifest."}, |
800 {"filtercopy", (PyCFunction)lazymanifest_filtercopy, METH_O, |
865 {"filtercopy", (PyCFunction)lazymanifest_filtercopy, METH_O, |
801 "Make a copy of this manifest filtered by matchfn."}, |
866 "Make a copy of this manifest filtered by matchfn."}, |
802 {"diff", (PyCFunction)lazymanifest_diff, METH_VARARGS, |
867 {"diff", (PyCFunction)lazymanifest_diff, METH_VARARGS, |