aboutsummaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves.c
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2000-10-19 12:26:49 +0000
committerFrederic Lepied <flepied@mandriva.com>2000-10-19 12:26:49 +0000
commitac2e4abe983f7de769ecef5e35f9c33f0bc88d7d (patch)
tree0bf54e676118f1acaf3727a15033c9afb81e489f /rpm-find-leaves.c
parent22043e605df0b810c7c688ee96c2a3caffe85f56 (diff)
downloadrpmtools-ac2e4abe983f7de769ecef5e35f9c33f0bc88d7d.tar
rpmtools-ac2e4abe983f7de769ecef5e35f9c33f0bc88d7d.tar.gz
rpmtools-ac2e4abe983f7de769ecef5e35f9c33f0bc88d7d.tar.bz2
rpmtools-ac2e4abe983f7de769ecef5e35f9c33f0bc88d7d.tar.xz
rpmtools-ac2e4abe983f7de769ecef5e35f9c33f0bc88d7d.zip
use iterators.
Diffstat (limited to 'rpm-find-leaves.c')
-rw-r--r--rpm-find-leaves.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rpm-find-leaves.c b/rpm-find-leaves.c
index c72337a..45e2e29 100644
--- a/rpm-find-leaves.c
+++ b/rpm-find-leaves.c
@@ -28,17 +28,18 @@ int main() {
int numConflicts;
rpmdb db;
int i;
+ rpmdbMatchIterator mi;
rpmReadConfigFiles(NULL, NULL);
db = open_rpmdb();
- for(i = rpmdbFirstRecNum(db); i; i = rpmdbNextRecNum(db, i)) {
+ while(header = rpmdbNextIterator(mi)) {
trans = rpmtransCreateSet(db, NULL);
+ i=rpmdbGetIteratorOffset(mi);
rpmtransRemovePackage(trans, i);
if (rpmdepCheck(trans, &conflicts, &numConflicts)) die("rpmdepCheck");
if (numConflicts == 0) {
- header = rpmdbGetRecord(db, i);
printf("%s-%s-%s\n", get(RPMTAG_NAME), get(RPMTAG_VERSION), get(RPMTAG_RELEASE));
headerFree(header);
}