xbps-query: repo_revdeps_cb: simplify by using a dictionary iterator.

This commit is contained in:
Juan RP 2012-11-30 10:45:26 +01:00
parent 731c903026
commit 9ac3b60048

View File

@ -88,17 +88,17 @@ static int
repo_revdeps_cb(struct xbps_rindex *rpi, void *arg, bool *done)
{
prop_dictionary_t pkgd;
prop_array_t allkeys, pkgdeps;
prop_dictionary_keysym_t ksym;
prop_array_t pkgdeps;
prop_object_iterator_t iter;
prop_object_t obj;
const char *pkgver, *arch, *pattern = arg;
size_t i;
(void)done;
allkeys = prop_dictionary_all_keys(rpi->repod);
for (i = 0; i < prop_array_count(allkeys); i++) {
ksym = prop_array_get(allkeys, i);
pkgd = prop_dictionary_get_keysym(rpi->repod, ksym);
iter = prop_dictionary_iterator(rpi->repod);
assert(iter);
while ((obj = prop_object_iterator_next(iter))) {
pkgd = prop_dictionary_get_keysym(rpi->repod, obj);
pkgdeps = prop_dictionary_get(pkgd, "run_depends");
if (pkgdeps == NULL || prop_array_count(pkgdeps) == 0)
continue;
@ -113,7 +113,7 @@ repo_revdeps_cb(struct xbps_rindex *rpi, void *arg, bool *done)
}
}
}
prop_object_release(allkeys);
prop_object_iterator_release(iter);
return 0;
}