aboutsummaryrefslogtreecommitdiff
path: root/build2/cli/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-02-02 10:20:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commit53f02bf28dae507a51515ed6ac03226d68816494 (patch)
tree234838165e802df9c777324c0fe766ce0190d814 /build2/cli/rule.cxx
parent601ffbd700e7c11a101215d641ea09d0181d4771 (diff)
Store extension in target map key rather than in target
This is in preparation for locking its modification/access.
Diffstat (limited to 'build2/cli/rule.cxx')
-rw-r--r--build2/cli/rule.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 773d00c..262e89a 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -211,17 +211,20 @@ namespace build2
const char* option,
const char* default_extension)
{
- assert (t.ext); // Should have been figured out in apply().
+ // Should have been figured out in apply().
+ //
+ const optional<string>& e (*t.ext_);
+ assert (e);
- if (*t.ext != default_extension)
+ if (*e != default_extension)
{
// CLI needs the extension with the leading dot (unless it is empty)
// while we store the extension without. But if there is an extension,
// then we can get it (with the dot) from the file name.
//
args.push_back (option);
- args.push_back (t.ext->empty ()
- ? t.ext->c_str ()
+ args.push_back (e->empty ()
+ ? e->c_str ()
: t.path ().extension_cstring () - 1);
}
}