From 8b35f7a1936b15e46e2f7a40f00f3ade5a60dccc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 13 Oct 2022 15:13:44 +0200 Subject: Fix bug in pkg-config metadata extraction logic --- libbuild2/cc/pkgconfig.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index 6023b45..7f667f0 100644 --- a/libbuild2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -802,14 +802,11 @@ namespace build2 context& ctx (t.ctx); - // These should be public (qualified) variables so go straight for - // the public variable pool. - // - auto& vp (ctx.var_pool.rw ()); // Load phase. - optional ver; optional pfx; + variable_pool* vp (nullptr); // Resolve lazily. + string s; for (size_t b (0), e (0); !(s = next (md, b, e)).empty (); ) { @@ -870,7 +867,13 @@ namespace build2 : name (move (s))); } - const variable& var (vp.insert (move (vn))); + // These should be public (qualified) variables so go straight for + // the public variable pool. + // + if (vp == nullptr) + vp = &ctx.var_pool.rw (); // Load phase if user==true. + + const variable& var (vp->insert (move (vn))); value& v (t.assign (var)); v.assign (move (ns), &var); -- cgit v1.1