xbps_find_pkg_orphans: minor optimizations.

This commit is contained in:
Juan RP 2013-12-08 08:06:28 +01:00
parent eba8ca0319
commit 2d5a8dee19

View File

@ -122,27 +122,25 @@ find_orphans:
for (unsigned int x = 0; x < xbps_array_count(rdeps); x++) { for (unsigned int x = 0; x < xbps_array_count(rdeps); x++) {
cnt = 0; cnt = 0;
xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver); xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver);
if (xbps_find_pkg_in_array(array, deppkgver))
continue;
reqby = xbps_pkgdb_get_pkg_revdeps(xhp, deppkgver); reqby = xbps_pkgdb_get_pkg_revdeps(xhp, deppkgver);
if (reqby == NULL) if (reqby == NULL)
continue; continue;
reqbycnt = xbps_array_count(reqby); reqbycnt = xbps_array_count(reqby);
for (unsigned int j = 0; j < reqbycnt; j++) { for (unsigned int j = 0; j < reqbycnt; j++) {
xbps_array_get_cstring_nocopy(reqby, j, &reqbydep); xbps_array_get_cstring_nocopy(reqby, j, &reqbydep);
if (xbps_find_pkg_in_array(array, reqbydep)) { if (xbps_find_pkg_in_array(array, reqbydep))
cnt++; cnt++;
continue;
}
} }
if (cnt == reqbycnt) { if (cnt == reqbycnt) {
deppkgd = xbps_pkgdb_get_pkg(xhp, deppkgver); deppkgd = xbps_pkgdb_get_pkg(xhp, deppkgver);
if (!xbps_find_pkg_in_array(array, deppkgver)) {
xbps_dictionary_get_bool(deppkgd, "automatic-install", &automatic); xbps_dictionary_get_bool(deppkgd, "automatic-install", &automatic);
if (automatic) if (automatic)
xbps_array_add(array, deppkgd); xbps_array_add(array, deppkgd);
} }
} }
} }
}
return array; return array;
} }