libxbps: simplify pkgdb_get_pkgd and find_pkg_dict_installed internals.

There's no need to prop_dictionary_copy the returned dictionary to
later have to free it again, just return directly the dictionary and
avoid the free(3)s.
This commit is contained in:
Juan RP
2012-06-16 09:02:07 +02:00
parent 068cab8d20
commit 974b2fe8ad
19 changed files with 28 additions and 96 deletions

View File

@ -83,15 +83,10 @@ xbps_check_is_installed_pkg_by_pattern(struct xbps_handle *xhp,
* Check that package state is fully installed, not
* unpacked or something else.
*/
if (xbps_pkg_state_dictionary(dict, &state) != 0) {
prop_object_release(dict);
if (xbps_pkg_state_dictionary(dict, &state) != 0)
return -1; /* error */
}
if (state != XBPS_PKG_STATE_INSTALLED) {
prop_object_release(dict);
if (state != XBPS_PKG_STATE_INSTALLED)
return 0; /* not fully installed */
}
prop_object_release(dict);
return 1;
}
@ -108,7 +103,6 @@ xbps_check_is_installed_pkg_by_name(struct xbps_handle *xhp,
((pkgd = xbps_find_virtualpkg_dict_installed(xhp, pkgname, false)) == NULL))
return false;
prop_object_release(pkgd);
return true;
}