diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-11-11 15:50:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-11-11 17:51:28 +0200 |
commit | 45ae0f38febb82a99844df84b65ec0fec31d2918 (patch) | |
tree | 15c1c65b8cb4645720242796c7abaf201eb57e42 /libbuild2/config/module.cxx | |
parent | 07e0d37aba5cd72ff2d53eda654a4d5466e38627 (diff) |
Change default for unused config.import.* variables from drop to keep
Diffstat (limited to 'libbuild2/config/module.cxx')
-rw-r--r-- | libbuild2/config/module.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libbuild2/config/module.cxx b/libbuild2/config/module.cxx index b43f1d9..10ec833 100644 --- a/libbuild2/config/module.cxx +++ b/libbuild2/config/module.cxx @@ -10,7 +10,7 @@ namespace build2 { namespace config { - void module:: + bool module:: save_variable (const variable& var, uint64_t flags) { const string& n (var.name); @@ -27,7 +27,7 @@ namespace build2 { // @@ For now with 'config.' prefix. // - i = sm.insert (string (n, 0, n.find ('.', 7))); + i = sm.insert (string (n, 0, n.find ('.', 7))).first; } // Don't insert duplicates. The config.import.* vars are particularly @@ -36,16 +36,20 @@ namespace build2 saved_variables& sv (i->second); auto j (sv.find (var)); - if (j == sv.end ()) - sv.push_back (saved_variable {var, flags}); - else + if (j != sv.end ()) + { assert (j->flags == flags); + return false; + } + + sv.push_back (saved_variable {var, flags}); + return true; } - void module:: + bool module:: save_module (const char* name, int prio) { - saved_modules.insert (string ("config.") += name, prio); + return saved_modules.insert (string ("config.") += name, prio).second; } const string module::name ("config"); |