diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-19 16:50:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-19 16:50:40 +0200 |
commit | 5164c843513212ab1ac1f721c4de04b6a865eb0c (patch) | |
tree | 1c6b2f440bd6dcd41fed60e76095bae2bf4e9e54 /build2/prerequisite.cxx | |
parent | 5607313a91e5ca0113b1f8b9acfd02c1fb105346 (diff) |
Get rid of extension_pool
Diffstat (limited to 'build2/prerequisite.cxx')
-rw-r--r-- | build2/prerequisite.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx index 82d6ea2..bcd4123 100644 --- a/build2/prerequisite.cxx +++ b/build2/prerequisite.cxx @@ -56,7 +56,7 @@ namespace build2 dir_path dir, dir_path out, string name, - const string* ext, + optional<string> ext, scope& s, tracer& trace) -> pair<prerequisite&, bool> { @@ -66,8 +66,13 @@ namespace build2 // Find or insert. // - auto r ( - emplace (move (proj), tt, move (dir), move (out), move (name), ext, s)); + auto r (emplace (move (proj), + tt, + move (dir), + move (out), + move (name), + ext, // Note: cannot move. + s)); prerequisite& p (const_cast<prerequisite&> (*r.first)); // Update extension if the existing prerequisite has it unspecified. @@ -78,7 +83,7 @@ namespace build2 diag_record r (trace); r << "assuming prerequisite " << p << " is the same as the " << "one with "; - if (ext == nullptr) + if (!ext) r << "unspecified extension"; else if (ext->empty ()) r << "no extension"; @@ -86,8 +91,8 @@ namespace build2 r << "extension " << *ext; }); - if (ext != nullptr) - p.ext = ext; + if (ext) + const_cast<optional<string>&> (p.ext) = move (ext); } return pair<prerequisite&, bool> (p, r.second); |