cache: use pkgconf_dependency_free instead of just setting match = NULL

This also means that we don't need to call unref on the pkgs, they've
already been freed by the dependency_free code
Dylan Baker 2022-07-27 13:55:47 -07:00
parent 21a645df00
commit 7025581da8
1 changed files with 4 additions and 22 deletions

View File

@ -186,18 +186,6 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
client->cache_count, sizeof(void *)); client->cache_count, sizeof(void *));
} }
static inline void
clear_dependency_matches(pkgconf_list_t *list)
{
pkgconf_node_t *iter;
PKGCONF_FOREACH_LIST_ENTRY(list->head, iter)
{
pkgconf_dependency_t *dep = iter->data;
dep->match = NULL;
}
}
/* /*
* !doc * !doc
* *
@ -224,18 +212,12 @@ pkgconf_cache_free(pkgconf_client_t *client)
{ {
pkgconf_pkg_t *pkg = cache_table[i]; pkgconf_pkg_t *pkg = cache_table[i];
clear_dependency_matches(&pkg->required); pkgconf_dependency_free(&pkg->required);
clear_dependency_matches(&pkg->requires_private); pkgconf_dependency_free(&pkg->requires_private);
clear_dependency_matches(&pkg->provides); pkgconf_dependency_free(&pkg->provides);
clear_dependency_matches(&pkg->conflicts); pkgconf_dependency_free(&pkg->conflicts);
} }
/* now forcibly free everything */
for (i = 0, count = client->cache_count; i < count; i++)
{
pkgconf_pkg_t *pkg = cache_table[i];
pkgconf_pkg_unref(client, pkg);
}
free(cache_table); free(cache_table);
PKGCONF_TRACE(client, "cleared package cache"); PKGCONF_TRACE(client, "cleared package cache");