summaryrefslogtreecommitdiff
path: root/lib/rpmgi.c
diff options
context:
space:
mode:
authorRakesh Pandit <rakesh@fedoraproject.org>2009-03-14 18:38:53 +0530
committerPanu Matilainen <pmatilai@redhat.com>2009-04-23 12:16:57 +0300
commit4b523ac1b85b9d4f71cd024306f01c3fb2418c8f (patch)
tree81c3093acf9b2826dcbce15711bb34d0be8d187a /lib/rpmgi.c
parent5bb4b0928393a4534d9f76644f7b3d3c74ceb3f2 (diff)
downloadlibrpm-tizen-4b523ac1b85b9d4f71cd024306f01c3fb2418c8f.tar.gz
librpm-tizen-4b523ac1b85b9d4f71cd024306f01c3fb2418c8f.tar.bz2
librpm-tizen-4b523ac1b85b9d4f71cd024306f01c3fb2418c8f.zip
- Removed unnecessary rpmdbFreeIterator call and moved them to enditer label.
- Rearranged bit to keep the logic sane.
Diffstat (limited to 'lib/rpmgi.c')
-rw-r--r--lib/rpmgi.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/rpmgi.c b/lib/rpmgi.c
index cfe4367d2..4f9692e4e 100644
--- a/lib/rpmgi.c
+++ b/lib/rpmgi.c
@@ -371,7 +371,6 @@ fprintf(stderr, "\tav %p[%ld]: \"%s\" -> %s ~= \"%s\"\n", gi->argv, (long) (av -
if (res == 0)
continue;
- gi->mi = rpmdbFreeIterator(gi->mi); /* XXX odd side effect? */
rpmrc = RPMRC_FAIL;
break;
}
@@ -489,11 +488,8 @@ rpmRC rpmgiNext(rpmgi gi)
case RPMDBI_PACKAGES:
if (!gi->active) {
rpmrc = rpmgiInitFilter(gi);
- if (rpmrc != RPMRC_OK) {
- gi->mi = rpmdbFreeIterator(gi->mi); /* XXX unnecessary */
- goto enditer;
- }
- rpmrc = RPMRC_NOTFOUND; /* XXX hack */
+ if (rpmrc != RPMRC_OK)
+ goto enditer;
gi->active = 1;
}
if (gi->mi != NULL) { /* XXX unnecessary */
@@ -505,10 +501,10 @@ rpmRC rpmgiNext(rpmgi gi)
gi->hdrPath = rpmExpand("rpmdb h# ", hnum, NULL);
rpmrc = RPMRC_OK;
/* XXX header reference held by iterator, so no headerFree */
- }
+ } else
+ rpmrc = RPMRC_NOTFOUND;
}
if (rpmrc != RPMRC_OK) {
- gi->mi = rpmdbFreeIterator(gi->mi);
goto enditer;
}
break;
@@ -612,6 +608,7 @@ fprintf(stderr, "*** gi %p\t%p[%d]: %s\n", gi, gi->argv, gi->i, gi->argv[gi->i])
return rpmrc;
enditer:
+ gi->mi = rpmdbFreeIterator(gi->mi);
if (gi->flags & RPMGI_TSORDER) {
rpmts ts = gi->ts;
rpmps ps;