~lattis/muon

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH] libpkgconf: bypass list iteration when pulling variables/dependencies

Details
Message ID
<20210817215947.9814-1-ariadne@dereferenced.org>
DKIM signature
pass
Download raw message
Patch: +8 -25
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
Details
Message ID
<20210818152224.insyes76bibacyn3@hostomei>
In-Reply-To
<20210817215947.9814-1-ariadne@dereferenced.org> (view parent)
DKIM signature
pass
Download raw message
Looks good to me, thanks for this!

Stone
Details
Message ID
<430fc8c-cac3-120-6a73-8c48b82cfddf@dereferenced.org>
In-Reply-To
<20210818152224.insyes76bibacyn3@hostomei> (view parent)
DKIM signature
pass
Download raw message
Hi,

On Wed, 18 Aug 2021, Stone Tickle wrote:

> Looks good to me, thanks for this!

Thanks for merging so quickly.  By the way: pkgconf 1.8.1, due to be 
released this weekend, hopefully resolves the memory leak issues when 
working with muon, so you may wish to retry it.

Ariadne
Details
Message ID
<20210819121757.dv6wombpfsamcros@hostomei>
In-Reply-To
<430fc8c-cac3-120-6a73-8c48b82cfddf@dereferenced.org> (view parent)
DKIM signature
pass
Download raw message
> 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
Reply to thread Export thread (mbox)