32 #include "xbps_api_impl.h"
34 static prop_dictionary_t
35 get_pkg_in_array(prop_array_t array,
const char *str,
bool virtual)
37 prop_object_t obj = NULL;
38 prop_object_iterator_t iter;
39 const char *pkgver, *dpkgn;
42 iter = prop_array_iterator(array);
45 while ((obj = prop_object_iterator_next(iter))) {
60 if (!prop_dictionary_get_cstring_nocopy(obj,
69 if (!prop_dictionary_get_cstring_nocopy(obj,
72 if (strcmp(str, pkgver) == 0) {
78 if (!prop_dictionary_get_cstring_nocopy(obj,
81 if (strcmp(dpkgn, str) == 0) {
87 prop_object_iterator_release(iter);
89 return found ? obj : NULL;
92 prop_dictionary_t HIDDEN
93 xbps_find_pkg_in_array(prop_array_t a,
const char *s)
95 assert(prop_object_type(a) == PROP_TYPE_ARRAY);
98 return get_pkg_in_array(a, s,
false);
101 prop_dictionary_t HIDDEN
102 xbps_find_virtualpkg_in_array(
struct xbps_handle *x,
106 prop_dictionary_t pkgd;
108 bool bypattern =
false;
111 assert(prop_object_type(a) == PROP_TYPE_ARRAY);
117 if ((vpkg = vpkg_user_conf(x, s, bypattern))) {
118 if ((pkgd = get_pkg_in_array(a, vpkg,
true)))
122 return get_pkg_in_array(a, s,
true);