From 219e00f3b8caec38a9c8fbb4d70e33455aba5a92 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 13 Oct 2022 09:00:11 +0200 Subject: Optimize by going straight to public variable pool where applicable --- libbuild2/config/init.cxx | 7 +++++-- libbuild2/config/utility.cxx | 4 ++-- libbuild2/config/utility.hxx | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'libbuild2/config') diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx index 72ded05..7035ce5 100644 --- a/libbuild2/config/init.cxx +++ b/libbuild2/config/init.cxx @@ -100,7 +100,10 @@ namespace build2 // reserved to not be valid module names (`build`). We also currently // treat `import` as special. // - auto& vp (rs.var_pool ()); + // All the variables we enter are qualified so go straight for the + // public variable pool. + // + auto& vp (rs.var_pool (true /* public */)); // NOTE: all config.** variables are by default made (via a pattern) to // be overridable with global visibility. So we must override this if a @@ -234,7 +237,7 @@ namespace build2 ? &extra.module_as () : nullptr); - auto& vp (rs.var_pool ()); + auto& vp (rs.var_pool (true /* public */)); // Note: config.* is pattern-typed to global visibility. // diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index 314de84..6574367 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -130,7 +130,7 @@ namespace build2 // Pattern-typed as bool. // const variable& var ( - rs.var_pool ().insert ("config." + n + ".configured")); + rs.var_pool (true).insert ("config." + n + ".configured")); save_variable (rs, var); @@ -144,7 +144,7 @@ namespace build2 // Pattern-typed as bool. // const variable& var ( - rs.var_pool ().insert ("config." + n + ".configured")); + rs.var_pool (true).insert ("config." + n + ".configured")); save_variable (rs, var); diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx index 98d7ec0..1e2ff53 100644 --- a/libbuild2/config/utility.hxx +++ b/libbuild2/config/utility.hxx @@ -435,7 +435,7 @@ namespace build2 const V* cv ( cast_null ( lookup_config (rs, - rs.var_pool ().insert ("config." + var), + rs.var_pool (true).insert ("config." + var), std::forward (default_value)))); // VC14 value& v (bs.assign (move (var))); @@ -453,7 +453,7 @@ namespace build2 const V* cv ( cast_null ( lookup_config (rs, - rs.var_pool ().insert ("config." + var), + rs.var_pool (true).insert ("config." + var), std::forward (default_value)))); // VC14 value& v (bs.append (move (var))); -- cgit v1.1