bin/xbps-query/list.c: simplify list_orphans().
This commit is contained in:
parent
20f2d10527
commit
84d0e429ab
@ -116,23 +116,16 @@ int
|
|||||||
list_orphans(struct xbps_handle *xhp)
|
list_orphans(struct xbps_handle *xhp)
|
||||||
{
|
{
|
||||||
xbps_array_t orphans;
|
xbps_array_t orphans;
|
||||||
xbps_object_iterator_t iter;
|
|
||||||
xbps_object_t obj;
|
|
||||||
const char *pkgver;
|
const char *pkgver;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
orphans = xbps_find_pkg_orphans(xhp, NULL);
|
orphans = xbps_find_pkg_orphans(xhp, NULL);
|
||||||
if (orphans == NULL)
|
if (orphans == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if (xbps_array_count(orphans) == 0)
|
for (i = 0; i < xbps_array_count(orphans); i++) {
|
||||||
return 0;
|
xbps_dictionary_get_cstring_nocopy(xbps_array_get(orphans, i),
|
||||||
|
"pkgver", &pkgver);
|
||||||
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);
|
|
||||||
printf("%s\n", pkgver);
|
printf("%s\n", pkgver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user