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:
@@ -185,8 +185,6 @@ out:
|
||||
prop_object_release(filesd);
|
||||
if (prop_object_type(propsd) == PROP_TYPE_DICTIONARY)
|
||||
prop_object_release(propsd);
|
||||
if (prop_object_type(opkgd) == PROP_TYPE_DICTIONARY)
|
||||
prop_object_release(opkgd);
|
||||
if (broken)
|
||||
return 1;
|
||||
|
||||
|
@@ -162,10 +162,8 @@ remove_stale_entries_in_reqby(struct xbps_handle *xhp,
|
||||
|
||||
for (i = 0; i < prop_array_count(reqby); i++) {
|
||||
prop_array_get_cstring_nocopy(reqby, i, &str);
|
||||
if ((pkgd = xbps_pkgdb_get_pkgd_by_pkgver(xhp, str)) != NULL) {
|
||||
prop_object_release(pkgd);
|
||||
if ((pkgd = xbps_pkgdb_get_pkgd_by_pkgver(xhp, str)) != NULL)
|
||||
continue;
|
||||
}
|
||||
printf("%s: found stale entry in requiredby `%s' (fixed)\n",
|
||||
crd->pkgver, str);
|
||||
if (xbps_remove_string_from_array(xhp, crd->pkgd_reqby, str))
|
||||
|
@@ -76,7 +76,6 @@ show_pkg_reverse_deps(struct xbps_handle *xhp, const char *pkgname)
|
||||
}
|
||||
rv = xbps_callback_array_iter_in_dict(xhp, pkgd, "requiredby",
|
||||
list_strings_sep_in_array, NULL);
|
||||
prop_object_release(pkgd);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@@ -89,7 +89,6 @@ state_cb(struct xbps_handle *xhp,
|
||||
pkgd = xbps_find_pkg_dict_installed(xhp,
|
||||
xscd->pkgname, false);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "version", &version);
|
||||
prop_object_release(pkgd);
|
||||
printf("Updating `%s' (`%s' to `%s') ...\n", xscd->pkgname,
|
||||
version, xscd->version);
|
||||
break;
|
||||
|
@@ -337,7 +337,6 @@ remove_pkg(struct xbps_handle *xhp, const char *pkgname, bool recursive)
|
||||
pkgd = xbps_find_pkg_dict_installed(xhp, pkgname, false);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
reqby = prop_dictionary_get(pkgd, "requiredby");
|
||||
prop_object_release(pkgd);
|
||||
printf("WARNING: %s IS REQUIRED BY %u PACKAGE%s:\n\n",
|
||||
pkgver, prop_array_count(reqby),
|
||||
prop_array_count(reqby) > 1 ? "S" : "");
|
||||
|
Reference in New Issue
Block a user