aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/install
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-13 09:00:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-13 09:00:11 +0200
commit219e00f3b8caec38a9c8fbb4d70e33455aba5a92 (patch)
treeaf77a460d37589b6ca535cdd8d0100440d9f45a1 /libbuild2/install
parent7935281661a3fd50454432fae1bbf4152758137a (diff)
Optimize by going straight to public variable pool where applicable
Diffstat (limited to 'libbuild2/install')
-rw-r--r--libbuild2/install/init.cxx27
-rw-r--r--libbuild2/install/utility.hxx2
2 files changed, 16 insertions, 13 deletions
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<CT> (move (vn)));
+ const variable& vr (vp.insert<CT> (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<T> (move (vn)));
+ const variable& vr (vp.insert<T> (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<bool> (string ("install.") + n + ".subdirs");
+ rs.var_pool (true).insert<bool> (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<path> ("install", variable_visibility::target));
+ auto& ovar (rs.var_pool ().insert<path> ("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<bool> ("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<bool> ("for_install", variable_visibility::prereq);
- vp.insert<string> ("install.mode");
- vp.insert<bool> ("install.subdirs");
- }
+ vp.insert<string> ("install.mode");
+ vp.insert<bool> ("install.subdirs");
// Environment.
//
diff --git a/libbuild2/install/utility.hxx b/libbuild2/install/utility.hxx
index 52b9a54..3e2dcad 100644
--- a/libbuild2/install/utility.hxx
+++ b/libbuild2/install/utility.hxx
@@ -43,7 +43,7 @@ namespace build2
{
auto r (
s.target_vars[tt]["*"].insert (
- *s.var_pool ().find ("install.mode")));
+ *s.ctx.var_pool.find ("install.mode")));
if (r.second) // Already set by the user?
r.first = move (m);