> Thanks for merging so quickly.
No problem
> By the way: pkgconf 1.8.1, due to be released this weekend, hopefully
> resolves the memory leak issues
I wonder if you are talking about #225[1]? Actually, that was my PR! I
tested it a bit with muon, and it resolved most of the leaks I believe.
I was still running into issues when initializing/deinitializing the
main pkgconf_client more than one time. I will check it again when
1.8.1 is released though.
Stone
1: https://github.com/pkgconf/pkgconf/pull/225
List iteration is only needed for dependency graphs where multiple dependencies
are specified in the queue. In the case of muon, the dependency resolution queue
only has a single dependency in the resolution queue in any case.
Because of various reasons (people doing crazy things in their autoconf scripts),
pkgconf has to support --modversion et al for multiple dependencies, like its
freedesktop.org counterpart, but this thankfully does not apply to muon.
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
---
src/external/libpkgconf.c | 33 ++++++++-------------------------
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/src/external/libpkgconf.c b/src/external/libpkgconf.c
index 571111f..5bff68d 100644
--- a/src/external/libpkgconf.c+++ b/src/external/libpkgconf.c
@@ -224,22 +224,12 @@ ret:
static bool
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *_ctx, int maxdepth)
{
- pkgconf_node_t *node;- bool first = true; struct pkgconf_lookup_ctx *ctx = _ctx;
+ pkgconf_dependency_t *dep = world->required.head->data;+ pkgconf_pkg_t *pkg = dep->match;- PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node){- if (!first) {- assert(false && "there should only be one version for one package, right?");- }- first = false;-- pkgconf_dependency_t *dep = node->data;- pkgconf_pkg_t *pkg = dep->match;-- if (pkg->version != NULL) {- strncpy(ctx->info->version, pkg->version, MAX_VERSION_LEN);- }+ if (pkg != NULL && pkg->version != NULL) {+ strncpy(ctx->info->version, pkg->version, MAX_VERSION_LEN); }
return true;
@@ -307,19 +297,12 @@ static bool
apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *_ctx, int maxdepth)
{
struct pkgconf_get_variable_ctx *ctx = _ctx;
- pkgconf_node_t *node;- bool first = true, found = false;+ bool found = false; const char *var;
+ pkgconf_dependency_t *dep = world->required.head->data;+ pkgconf_pkg_t *pkg = dep->match;- PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node){- if (!first) {- assert(false && "there should only be one iteration for one package, right?");- }- first = false;-- pkgconf_dependency_t *dep = node->data;- pkgconf_pkg_t *pkg = dep->match;-+ if (pkg != NULL) { var = pkgconf_tuple_find(client, &pkg->vars, ctx->var);
if (var != NULL) {
*ctx->res = wk_str_push(ctx->wk, var);
--
2.33.0