From 45ae0f38febb82a99844df84b65ec0fec31d2918 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Nov 2019 15:50:44 +0200 Subject: Change default for unused config.import.* variables from drop to keep --- libbuild2/config/module.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libbuild2/config/module.cxx') 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"); -- cgit v1.1