From 0cb5de3fc090cae426b812ad3e38e2be8b7e63ac Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 22 Sep 2009 20:50:41 +0300 Subject: [PATCH] Lose unnecessary next() methods - python adds next() methods for objects supporting iterators --- python/rpmds-py.c | 16 ---------------- python/rpmfi-py.c | 37 ------------------------------------- python/rpmmi-py.c | 18 ------------------ python/rpmts-py.c | 23 ----------------------- 4 files changed, 94 deletions(-) diff --git a/python/rpmds-py.c b/python/rpmds-py.c index d13fe28..67af3fb 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -227,19 +227,6 @@ rpmds_iternext(rpmdsObject * s) } static PyObject * -rpmds_Next(rpmdsObject * s) -{ - PyObject * result; - - result = rpmds_iternext(s); - - if (result == NULL) { - Py_RETURN_NONE; - } - return result; -} - -static PyObject * rpmds_SetNoPromote(rpmdsObject * s, PyObject * args, PyObject * kwds) { int nopromote; @@ -386,9 +373,6 @@ static struct PyMethodDef rpmds_methods[] = { "ds.Color -> Color - Return current Color.\n" }, {"Refs", (PyCFunction)rpmds_Refs, METH_NOARGS, "ds.Refs -> Refs - Return current Refs.\n" }, - {"next", (PyCFunction)rpmds_Next, METH_NOARGS, -"ds.next() -> (N, EVR, Flags)\n\ -- Retrieve next dependency triple.\n" }, {"SetNoPromote",(PyCFunction)rpmds_SetNoPromote, METH_VARARGS|METH_KEYWORDS, NULL}, {"Notify", (PyCFunction)rpmds_Notify, METH_VARARGS|METH_KEYWORDS, diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index b48c980..cfc9892 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -221,34 +221,6 @@ rpmfi_iternext(rpmfiObject * s) return result; } -static PyObject * -rpmfi_Next(rpmfiObject * s) -{ - PyObject * result = NULL; - - result = rpmfi_iternext(s); - - if (result == NULL) { - Py_RETURN_NONE; - } - - return result; -} - -#ifdef NOTYET -static PyObject * -rpmfi_NextD(rpmfiObject * s) -{ - Py_RETURN_NONE; -} - -static PyObject * -rpmfi_InitD(rpmfiObject * s) -{ - Py_RETURN_NONE; -} -#endif - static struct PyMethodDef rpmfi_methods[] = { {"Debug", (PyCFunction)rpmfi_Debug, METH_VARARGS|METH_KEYWORDS, NULL}, @@ -294,15 +266,6 @@ static struct PyMethodDef rpmfi_methods[] = { NULL}, {"FClass", (PyCFunction)rpmfi_FClass, METH_NOARGS, NULL}, - {"next", (PyCFunction)rpmfi_Next, METH_NOARGS, -"fi.next() -> (FN, FSize, FMode, FMtime, FFlags, FRdev, FInode, FNlink, FState, VFlags, FUser, FGroup, FDigest))\n\ -- Retrieve next file info tuple.\n" }, -#ifdef NOTYET - {"NextD", (PyCFunction)rpmfi_NextD, METH_NOARGS, - NULL}, - {"InitD", (PyCFunction)rpmfi_InitD, METH_NOARGS, - NULL}, -#endif {NULL, NULL} /* sentinel */ }; diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index ea9941f..fad151d 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -90,21 +90,6 @@ rpmmi_iternext(rpmmiObject * s) /** */ static PyObject * -rpmmi_Next(rpmmiObject * s) -{ - PyObject * result; - - result = rpmmi_iternext(s); - - if (result == NULL) { - Py_RETURN_NONE; - } - return result; -} - -/** - */ -static PyObject * rpmmi_Instance(rpmmiObject * s) { int rc = 0; @@ -154,9 +139,6 @@ rpmmi_Pattern(rpmmiObject * s, PyObject * args, PyObject * kwds) /** \ingroup py_c */ static struct PyMethodDef rpmmi_methods[] = { - {"next", (PyCFunction) rpmmi_Next, METH_NOARGS, -"mi.next() -> hdr\n\ -- Retrieve next header that matches. Iterate directly in python if possible.\n" }, {"instance", (PyCFunction) rpmmi_Instance, METH_NOARGS, NULL }, {"count", (PyCFunction) rpmmi_Count, METH_NOARGS, diff --git a/python/rpmts-py.c b/python/rpmts-py.c index e250292..847c3f7 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -1001,26 +1001,6 @@ fprintf(stderr, "*** rpmts_iternext(%p) ts %p tsi %p %d\n", s, s->ts, s->tsi, s- } /** - * @todo Add TR_ADDED filter to iterator. - */ -static PyObject * -rpmts_Next(rpmtsObject * s) -{ - PyObject * result; - -if (_rpmts_debug) -fprintf(stderr, "*** rpmts_Next(%p) ts %p\n", s, s->ts); - - result = rpmts_iternext(s); - - if (result == NULL) { - Py_RETURN_NONE; - } - - return result; -} - -/** */ static specObject * spec_Parse(rpmtsObject * s, PyObject * args, PyObject * kwds) @@ -1187,9 +1167,6 @@ static struct PyMethodDef rpmts_methods[] = { {"dbMatch", (PyCFunction) rpmts_Match, METH_VARARGS|METH_KEYWORDS, "ts.dbMatch([TagN, [key, [len]]]) -> mi\n\ - Create a match iterator for the default transaction rpmdb.\n" }, - {"next", (PyCFunction)rpmts_Next, METH_NOARGS, -"ts.next() -> te\n\ -- Retrieve next transaction set element.\n" }, {NULL, NULL} /* sentinel */ }; -- 2.7.4