From 7025581da8721ca813e9260b572156751753e3c1 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 27 Jul 2022 13:55:47 -0700 Subject: [PATCH] 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 --- libpkgconf/cache.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/libpkgconf/cache.c b/libpkgconf/cache.c index 38f8e8b..9a7590f 100644 --- a/libpkgconf/cache.c +++ b/libpkgconf/cache.c @@ -186,18 +186,6 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg) 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 * @@ -224,18 +212,12 @@ pkgconf_cache_free(pkgconf_client_t *client) { pkgconf_pkg_t *pkg = cache_table[i]; - clear_dependency_matches(&pkg->required); - clear_dependency_matches(&pkg->requires_private); - clear_dependency_matches(&pkg->provides); - clear_dependency_matches(&pkg->conflicts); + pkgconf_dependency_free(&pkg->required); + pkgconf_dependency_free(&pkg->requires_private); + pkgconf_dependency_free(&pkg->provides); + 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); PKGCONF_TRACE(client, "cleared package cache");