From 5164c843513212ab1ac1f721c4de04b6a865eb0c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 19 Jan 2017 16:50:40 +0200 Subject: Get rid of extension_pool --- build2/prerequisite.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'build2/prerequisite.cxx') 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 ext, scope& s, tracer& trace) -> pair { @@ -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 (*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&> (p.ext) = move (ext); } return pair (p, r.second); -- cgit v1.1