From 9affd1491aa4ac4ee2c7626f451990dba1585290 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 8 Aug 2009 15:19:47 +0200 Subject: [PATCH] xbps_find_orphan_packages: use xbps_prepare_regpkgdb_dict(). --HG-- extra : convert_revision : 5c7b61ade09df674256ef9fb8f3b6d3e8d962ab3 --- lib/orphans.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/lib/orphans.c b/lib/orphans.c index 4251d3cf1c5..13431fe29b4 100644 --- a/lib/orphans.c +++ b/lib/orphans.c @@ -103,28 +103,14 @@ xbps_find_orphan_packages(void) prop_object_t obj; prop_object_iterator_t iter; struct orphan orphan; - const char *rootdir; - char *plist; int rv = 0; - rootdir = xbps_get_rootdir(); - plist = xbps_xasprintf("%s/%s/%s", rootdir, - XBPS_META_PATH, XBPS_REGPKGDB); - if (plist == NULL) + if ((dict = xbps_prepare_regpkgdb_dict()) == NULL) return NULL; - dict = prop_dictionary_internalize_from_file(plist); - if (dict == NULL) { - free(plist); - return NULL; - } - free(plist); - orphan.array = prop_array_create(); - if (orphan.array == NULL) { - prop_object_release(dict); + if (orphan.array == NULL) return NULL; - } /* * First look for direct orphan packages, i.e the ones @@ -133,7 +119,6 @@ xbps_find_orphan_packages(void) rv = xbps_callback_array_iter_in_dict(dict, "packages", find_orphan_pkg, (void *)&orphan); if (rv != 0) { - prop_object_release(dict); prop_object_release(orphan.array); return NULL; } @@ -144,7 +129,6 @@ xbps_find_orphan_packages(void) */ iter = prop_array_iterator(orphan.array); if (iter == NULL) { - prop_object_release(dict); prop_object_release(orphan.array); return NULL; } @@ -158,13 +142,11 @@ xbps_find_orphan_packages(void) find_indirect_orphan_pkg, (void *)&orphan); if (rv != 0) { prop_object_iterator_release(iter); - prop_object_release(dict); prop_object_release(orphan.array); return NULL; } } prop_object_iterator_release(iter); - prop_object_release(dict); return orphan.array; }