summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-10-19 12:35:20 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-10-19 12:35:20 +0300
commit36f1ac2c7b3a9030e3dfd59510fe285eac3dce88 (patch)
treee086b2ab26f778f12b610706211736b47e1ebf73 /python
parentb1c64e37fd170d08896d4cb9209f5241be138b09 (diff)
downloadlibrpm-tizen-36f1ac2c7b3a9030e3dfd59510fe285eac3dce88.tar.gz
librpm-tizen-36f1ac2c7b3a9030e3dfd59510fe285eac3dce88.tar.bz2
librpm-tizen-36f1ac2c7b3a9030e3dfd59510fe285eac3dce88.zip
Convert rpmts-py to use rpmps iterator
Diffstat (limited to 'python')
-rw-r--r--python/rpmts-py.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 5161c5a00..ac7a95ce2 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -387,9 +387,10 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
if (ps != NULL) {
list = PyList_New(0);
+ rpmpsi psi = rpmpsInitIterator(ps);
/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
- for (i = 0; i < ps->numProblems; i++) {
+ while ((i = rpmpsNextIterator(psi)) >= 0) {
#ifdef DYING
cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName,
conflicts[i].byVersion, conflicts[i].byRelease,
@@ -407,7 +408,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
int needsFlags, sense;
fnpyKey key;
- p = ps->probs + i;
+ p = rpmpsProblem(psi);
/* XXX autorelocated i386 on ia64, fix system-config-packages! */
if (p->type == RPMPROB_BADRELOCATE)
@@ -451,6 +452,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
Py_DECREF(cf);
}
+ psi = rpmpsFreeIterator(psi);
ps = rpmpsFree(ps);
return list;
@@ -1073,9 +1075,10 @@ fprintf(stderr, "*** rpmts_Problems(%p) ts %p\n", s, s->ts);
static PyObject *
rpmts_Run(rpmtsObject * s, PyObject * args, PyObject * kwds)
{
- int rc, i;
+ int rc;
PyObject * list;
rpmps ps;
+ rpmpsi psi;
struct rpmtsCallbackType_s cbInfo;
char * kwlist[] = {"callback", "data", NULL};
@@ -1120,8 +1123,9 @@ fprintf(stderr, "*** rpmts_Run(%p) ts %p ignore %x\n", s, s->ts, s->ignoreSet);
}
list = PyList_New(0);
- for (i = 0; i < ps->numProblems; i++) {
- rpmProblem p = ps->probs + i;
+ psi = rpmpsInitIterator(ps);
+ while (rpmpsNextIterator(psi) >= 0) {
+ rpmProblem p = rpmpsProblem(psi);
PyObject * prob = Py_BuildValue("s(isN)", rpmProblemString(p),
p->type,
p->str1,
@@ -1130,6 +1134,7 @@ fprintf(stderr, "*** rpmts_Run(%p) ts %p ignore %x\n", s, s->ts, s->ignoreSet);
Py_DECREF(prob);
}
+ psi = rpmpsFreeIterator(psi);
ps = rpmpsFree(ps);
return list;