Fix xbps_configure_packages() by avoiding proplib iterators.

This commit is contained in:
Juan RP 2012-01-16 14:41:16 +01:00
parent 865d69e0eb
commit ffa48b2cf3
3 changed files with 9 additions and 9 deletions

View File

@ -56,7 +56,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.3"
#define XBPS_API_VERSION "20120115"
#define XBPS_API_VERSION "20120116"
#define XBPS_VERSION "0.12"
/**

View File

@ -56,7 +56,6 @@ configure_pkgs_cb(prop_object_t obj, void *arg, bool *done)
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(obj, "version", &version);
return xbps_configure_pkg(pkgname, version, true, false, false);
}
@ -92,6 +91,7 @@ xbps_configure_pkg(const char *pkgname,
if (check_state) {
rv = xbps_pkg_state_installed(pkgname, &state);
xbps_dbg_printf("%s-%s: state %d\n", pkgname, version, state);
if (rv == ENOENT) {
/*
* package not installed or has been removed.
@ -109,7 +109,7 @@ xbps_configure_pkg(const char *pkgname,
} else if (state != XBPS_PKG_STATE_UNPACKED)
return EINVAL;
pkgd = xbps_find_pkg_dict_installed(pkgname, false);
pkgd = xbps_regpkgdb_get_pkgd(pkgname, false);
prop_dictionary_get_cstring_nocopy(pkgd, "version", &lver);
prop_object_release(pkgd);
} else {

View File

@ -106,8 +106,9 @@ xbps_callback_array_iter_in_dict(prop_dictionary_t dict,
int (*fn)(prop_object_t, void *, bool *),
void *arg)
{
prop_object_iterator_t iter;
prop_object_t obj;
prop_array_t array;
size_t i;
int rv = 0;
bool cbloop_done = false;
@ -115,18 +116,17 @@ xbps_callback_array_iter_in_dict(prop_dictionary_t dict,
assert(key != NULL);
assert(fn != NULL);
iter = xbps_array_iter_from_dict(dict, key);
if (iter == NULL)
array = prop_dictionary_get(dict, key);
if (prop_object_type(array) != PROP_TYPE_ARRAY)
return EINVAL;
while ((obj = prop_object_iterator_next(iter))) {
for (i = 0; i < prop_array_count(array); i++) {
obj = prop_array_get(array, i);
rv = (*fn)(obj, arg, &cbloop_done);
if (rv != 0 || cbloop_done)
break;
}
prop_object_iterator_release(iter);
return rv;
}