aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-11-29 14:02:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-11-29 14:03:21 +0200
commitd593b19735eec451b091fd46e4cb066e3478d6c9 (patch)
treebb9f4864745c0d7f71908f185734e01e9176cca0 /libbuild2/scope.hxx
parentbd90dfbbbca15500b826eb9a4bb6959aedbe28f7 (diff)
Move buildfiles to root_extra, use vector instead of unordered_set
Diffstat (limited to 'libbuild2/scope.hxx')
-rw-r--r--libbuild2/scope.hxx28
1 files changed, 19 insertions, 9 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 7989d59..3d31ff1 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -4,8 +4,6 @@
#ifndef LIBBUILD2_SCOPE_HXX
#define LIBBUILD2_SCOPE_HXX
-#include <unordered_set>
-
#include <libbuild2/types.hxx>
#include <libbuild2/forward.hxx>
#include <libbuild2/utility.hxx>
@@ -302,13 +300,6 @@ namespace build2
//
variable_type_map target_vars;
- // Set of buildfiles already loaded for this scope. The included
- // buildfiles are checked against the project's root scope while
- // imported -- against the global scope (global_scope).
- //
- public:
- std::unordered_set<path> buildfiles;
-
// Target types.
//
// Note that target types are project-wide (even if the module that
@@ -523,6 +514,25 @@ namespace build2
//
module_map modules;
+ // Buildfiles already loaded for this project.
+ //
+ // We don't expect too many of them per project so let's use vector
+ // with linear search.
+ //
+ paths buildfiles;
+
+ bool
+ insert_buildfile (const path& f)
+ {
+ bool r (find (buildfiles.begin (),
+ buildfiles.end (),
+ f) == buildfiles.end ());
+ if (r)
+ buildfiles.push_back (f);
+
+ return r;
+ }
+
// Variable override cache.
//
mutable variable_override_cache override_cache;