pkg: track the number of hits a package has gotten while solving for dependencies

master
Ariadne Conill 2022-06-26 07:22:56 +00:00
parent 6ae17bd0ef
commit 5817e8848f
2 changed files with 4 additions and 0 deletions

View File

@ -160,6 +160,8 @@ struct pkgconf_pkg_ {
pkgconf_tuple_t *prefix; pkgconf_tuple_t *prefix;
uint64_t serial; uint64_t serial;
size_t hits;
}; };
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data); typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);

View File

@ -1473,6 +1473,7 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
if (pkgdep->serial == client->serial) if (pkgdep->serial == client->serial)
{ {
pkgdep->hits++;
pkgconf_pkg_unref(client, pkgdep); pkgconf_pkg_unref(client, pkgdep);
continue; continue;
} }
@ -1485,6 +1486,7 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
pkgconf_audit_log_dependency(client, pkgdep, depnode); pkgconf_audit_log_dependency(client, pkgdep, depnode);
pkgdep->hits++;
pkgdep->serial = client->serial; pkgdep->serial = client->serial;
eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags); eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags);
pkgconf_pkg_unref(client, pkgdep); pkgconf_pkg_unref(client, pkgdep);