From dfa8b8e8ba195f9c39649bbd938bec59f8b098a9 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 16 Oct 2011 16:52:58 +0200 Subject: [PATCH] libxbps: make xbps_*_find_virtualpkg_*_by_name funcs work as expected. --- lib/plist_find.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/plist_find.c b/lib/plist_find.c index 092f5204..ccf4fd3b 100644 --- a/lib/plist_find.c +++ b/lib/plist_find.c @@ -146,13 +146,14 @@ find_virtualpkg_user_in_conf(const char *vpkg, bool bypattern) break; } } else { - vpkgname = xbps_pkgpattern_name(vpkgver); + vpkgname = xbps_pkg_name(vpkgver); if (vpkgname == NULL) break; - + if (strcmp(vpkg, vpkgname) == 0) { - pkg = vpkgname; free(vpkgname); + prop_dictionary_get_cstring_nocopy(obj, + "target-pkgpattern", &pkg); break; } free(vpkgname); @@ -170,7 +171,7 @@ find_virtualpkg_user_in_array(prop_array_t array, { prop_object_t obj = NULL; prop_object_iterator_t iter; - const char *pkgver, *dpkgn, *virtualpkg; + const char *pkgver, *virtualpkg; assert(array != NULL); assert(str != NULL); @@ -184,17 +185,10 @@ find_virtualpkg_user_in_array(prop_array_t array, return NULL; while ((obj = prop_object_iterator_next(iter))) { - if (bypattern) { - prop_dictionary_get_cstring_nocopy(obj, - "pkgver", &pkgver); - if (xbps_pkgpattern_match(pkgver, virtualpkg)) - break; - } else { - prop_dictionary_get_cstring_nocopy(obj, - "pkgname", &dpkgn); - if (strcmp(dpkgn, virtualpkg) == 0) - break; - } + prop_dictionary_get_cstring_nocopy(obj, + "pkgver", &pkgver); + if (xbps_pkgpattern_match(pkgver, virtualpkg)) + break; } prop_object_iterator_release(iter); return obj;