From 84d0e429ab03351ee4d96f0a5e752cfbcf28deeb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 27 Jul 2013 06:11:48 +0200 Subject: [PATCH] bin/xbps-query/list.c: simplify list_orphans(). --- bin/xbps-query/list.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/bin/xbps-query/list.c b/bin/xbps-query/list.c index 194ee5cf..6ee72c23 100644 --- a/bin/xbps-query/list.c +++ b/bin/xbps-query/list.c @@ -116,23 +116,16 @@ int list_orphans(struct xbps_handle *xhp) { xbps_array_t orphans; - xbps_object_iterator_t iter; - xbps_object_t obj; const char *pkgver; + unsigned int i; orphans = xbps_find_pkg_orphans(xhp, NULL); if (orphans == NULL) return EINVAL; - if (xbps_array_count(orphans) == 0) - return 0; - - iter = xbps_array_iterator(orphans); - if (iter == NULL) - return ENOMEM; - - while ((obj = xbps_object_iterator_next(iter)) != NULL) { - xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver); + for (i = 0; i < xbps_array_count(orphans); i++) { + xbps_dictionary_get_cstring_nocopy(xbps_array_get(orphans, i), + "pkgver", &pkgver); printf("%s\n", pkgver); }