diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-01-18 11:41:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-01-18 11:41:23 +0200 |
commit | d0954351f53c0de0d2b0a0e0f422a40f82142d5c (patch) | |
tree | 50b201da74cb3b56da8b7d53c970c4bdfcd827af /build2/scope.cxx | |
parent | 14b295bdb00305370ec0aaad7f4319bad55ad6e9 (diff) |
Use prefix_map::find_sup/sub()
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r-- | build2/scope.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx index 01a60a0..6fca9fb 100644 --- a/build2/scope.cxx +++ b/build2/scope.cxx @@ -760,7 +760,7 @@ namespace build2 { // The first entry is ourselves. // - auto r (m.find_prefix (k)); + auto r (m.find_sub (k)); for (++r.first; r.first != r.second; ++r.first) { scope& c (r.first->second); @@ -793,7 +793,7 @@ namespace build2 { // Upgrade to root scope. // - auto r (m.find_prefix (k)); + auto r (m.find_sub (k)); for (++r.first; r.first != r.second; ++r.first) { scope& c (r.first->second); @@ -813,12 +813,14 @@ namespace build2 { scope_map_base& m (*this); - // Better implementation that should work but doesn't. - // -#if 0 assert (k.normalized (false)); // Allow non-canonical dir separators. + + // Using find_sup() seems to be slightly slower. + // +#if 1 auto i (m.find_sup (k)); - return i != m.end () ? i->second : const_cast<scope&> (*global_scope); + assert (i != m.end ()); // Should have global scope. + return i->second; #else // Normally we would have a scope for the full path so try that before // making any copies. |