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/install/init.cxx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'libbuild2/install/init.cxx') diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx index 35c2d13..1a6ee0f 100644 --- a/libbuild2/install/init.cxx +++ b/libbuild2/install/init.cxx @@ -166,6 +166,8 @@ namespace build2 bool global (*name == '\0'); + auto& vp (rs.var_pool (true /* default */)); // All qualified. + if (spec) { vn = "config.install"; @@ -175,7 +177,7 @@ namespace build2 vn += name; } vn += var; - const variable& vr (rs.var_pool ().insert (move (vn))); + const variable& vr (vp.insert (move (vn))); using config::lookup_config; @@ -192,7 +194,7 @@ namespace build2 vn = "install."; vn += name; vn += var; - const variable& vr (rs.var_pool ().insert (move (vn))); + const variable& vr (vp.insert (move (vn))); value& v (rs.assign (vr)); @@ -236,7 +238,7 @@ namespace build2 // This one doesn't have config.* value (only set in a buildfile). // if (!global) - rs.var_pool ().insert (string ("install.") + n + ".subdirs"); + rs.var_pool (true).insert (string ("install.") + n + ".subdirs"); } void @@ -252,8 +254,6 @@ namespace build2 // Enter module variables (note that init() below enters some more). // - auto& vp (rs.var_pool ()); - // The install variable is a path, not dir_path, since it can be used // to both specify the target directory (to install with the same file // name) or target file (to install with a different name). And the @@ -263,7 +263,8 @@ namespace build2 // Plus it can have the special true/false values when acting as a // operation variable. // - auto& ovar (vp.insert ("install", variable_visibility::target)); + auto& ovar (rs.var_pool ().insert ("install", + variable_visibility::target)); // Register the install function family if this is the first instance of // the install modules. @@ -327,15 +328,17 @@ namespace build2 // Enter module variables. // - auto& vp (rs.var_pool ()); + rs.var_pool ().insert ("for_install", variable_visibility::prereq); + + // The rest of the variables we enter are qualified so go straight + // for the public variable pool. + // + auto& vp (rs.var_pool (true /* public */)); // Note that the set_dir() calls below enter some more. // - { - vp.insert ("for_install", variable_visibility::prereq); - vp.insert ("install.mode"); - vp.insert ("install.subdirs"); - } + vp.insert ("install.mode"); + vp.insert ("install.subdirs"); // Environment. // -- cgit v1.1