summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-03-19 19:25:23 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-03-19 19:25:23 +0200
commit606ceca33302751af140d8d9ebca598a6a06a39b (patch)
tree76cb8449a0c6abd8ea05474de34a673e48232278
parentaf659c87ce93b3d1506d5fdf6bece4891758eea4 (diff)
downloadlibrpm-tizen-606ceca33302751af140d8d9ebca598a6a06a39b.tar.gz
librpm-tizen-606ceca33302751af140d8d9ebca598a6a06a39b.tar.bz2
librpm-tizen-606ceca33302751af140d8d9ebca598a6a06a39b.zip
Return headers from rpmgiNext() directly
-rw-r--r--lib/query.c7
-rw-r--r--lib/rpmgi.c13
-rw-r--r--lib/rpmgi.h12
3 files changed, 8 insertions, 24 deletions
diff --git a/lib/query.c b/lib/query.c
index 9cf270847..8e296b517 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -270,15 +270,12 @@ static int rpmgiShowMatches(QVA_t qva, rpmts ts)
{
rpmgi gi = qva->qva_gi;
int ec = 0;
+ Header h;
- while (rpmgiNext(gi) == RPMRC_OK) {
- Header h;
+ while ((h = rpmgiNext(gi)) != NULL) {
int rc;
rpmdbCheckSignals();
- h = rpmgiHeader(gi);
- if (h == NULL) /* XXX perhaps stricter break instead? */
- continue;
if ((rc = qva->qva_showPackage(qva, ts, h)) != 0)
ec = rc;
}
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index 92a356dcd..c7407d83f 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -229,12 +229,12 @@ rpmgi rpmgiNew(rpmts ts, rpmgiFlags flags, ARGV_const_t argv)
return gi;
}
-rpmRC rpmgiNext(rpmgi gi)
+Header rpmgiNext(rpmgi gi)
{
rpmRC rpmrc = RPMRC_NOTFOUND;
if (gi == NULL)
- return rpmrc;
+ return NULL;
/* Free header from previous iteration. */
gi->h = headerFree(gi->h);
@@ -256,18 +256,13 @@ rpmRC rpmgiNext(rpmgi gi)
goto enditer;
}
- return rpmrc;
+ return gi->h;
enditer:
gi->h = headerFree(gi->h);
gi->i = -1;
gi->active = 0;
- return rpmrc;
-}
-
-Header rpmgiHeader(rpmgi gi)
-{
- return (gi != NULL ? gi->h : NULL);
+ return NULL;
}
int rpmgiNumErrors(rpmgi gi)
diff --git a/lib/rpmgi.h b/lib/rpmgi.h
index 079109f08..79abbe621 100644
--- a/lib/rpmgi.h
+++ b/lib/rpmgi.h
@@ -47,18 +47,10 @@ rpmgi rpmgiNew(rpmts ts, rpmgiFlags flags, ARGV_const_t argv);
/** \ingroup rpmgi
* Perform next iteration step.
* @param gi generalized iterator
- * @returns RPMRC_OK on success, RPMRC_NOTFOUND on EOI
+ * @returns next header, NULL on end of iteration
*/
RPM_GNUC_INTERNAL
-rpmRC rpmgiNext(rpmgi gi);
-
-/** \ingroup rpmgi
- * Return current iteration header.
- * @param gi generalized iterator
- * @returns header
- */
-RPM_GNUC_INTERNAL
-Header rpmgiHeader(rpmgi gi);
+Header rpmgiNext(rpmgi gi);
/** \ingroup rpmgi
* Return number of errors (file not found etc) encountered during iteration