From 441c75f68ca1adfcf833ae778ac150baf16ded2f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Mar 2022 10:25:10 +0200 Subject: Add variable_map::lookup_namespace(string) overload --- libbuild2/config/init.cxx | 4 ---- libbuild2/config/operation.cxx | 2 +- libbuild2/config/utility.cxx | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'libbuild2/config') diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx index 0472cfd..5dd2789 100644 --- a/libbuild2/config/init.cxx +++ b/libbuild2/config/init.cxx @@ -175,10 +175,6 @@ namespace build2 if (!d) { - // Used as a variable prefix by configure_execute(). - // - vp.insert ("config"); - // Adjust priority for the config module and import pseudo-module so // that their variables come first in config.build. // diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx index 2fb0423..4597af4 100644 --- a/libbuild2/config/operation.cxx +++ b/libbuild2/config/operation.cxx @@ -209,7 +209,7 @@ namespace build2 // auto& vp (ctx.var_pool); - for (auto p (rs.vars.lookup_namespace (*vp.find ("config"))); + for (auto p (rs.vars.lookup_namespace ("config")); p.first != p.second; ++p.first) { diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index 928709a..a78b263 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -91,7 +91,7 @@ namespace build2 // any original values, they will be "visible"; see find_override() for // details. // - const variable& ns (vp.insert ("config." + n)); + const string ns ("config." + n); for (scope* s (&rs); s != nullptr; s = s->parent_scope ()) { for (auto p (s->vars.lookup_namespace (ns)); @@ -107,12 +107,12 @@ namespace build2 auto match_tail = [&ns, v] (const char* t) { - return v->name.compare (ns.name.size () + 1, string::npos, t) == 0; + return v->name.compare (ns.size () + 1, string::npos, t) == 0; }; // Ignore config.*.configured and user-supplied names. // - if (v->name.size () <= ns.name.size () || + if (v->name.size () <= ns.size () || (!match_tail ("configured") && find_if (ig.begin (), ig.end (), match_tail) == ig.end ())) return true; -- cgit v1.1