From a46ce3672fab56d6e1ee1c1e493fda62dbf8e13b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Aug 2022 16:40:04 -0700 Subject: [PATCH] queue: when collecting dependents don't iterate private twice Currently, the private field is iterated collecting private deps and normal deps. It should only be iterated when collecting private deps. --- libpkgconf/queue.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libpkgconf/queue.c b/libpkgconf/queue.c index 13f93e4..c353e7e 100644 --- a/libpkgconf/queue.c +++ b/libpkgconf/queue.c @@ -116,22 +116,27 @@ pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, v if (pkg == world) return; - PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node) + if (!(pkg->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)) { - pkgconf_dependency_t *flattened_dep; + PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node) + { + pkgconf_dependency_t *flattened_dep; - flattened_dep = pkgconf_dependency_copy(client, node->data); + flattened_dep = pkgconf_dependency_copy(client, node->data); - pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required); + pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required); + } } - - PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node) + else { - pkgconf_dependency_t *flattened_dep; + PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node) + { + pkgconf_dependency_t *flattened_dep; - flattened_dep = pkgconf_dependency_copy(client, node->data); + flattened_dep = pkgconf_dependency_copy(client, node->data); - pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private); + pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private); + } } }