diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-01-06 06:59:31 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-01-06 07:24:42 +0200 |
commit | 6a242a8050edd0a33ea0e770a6eca4823a98b8d1 (patch) | |
tree | 85be41222d59fc94448e9788f85304c3fc29712d /libbuild2/adhoc-rule-regex-pattern.cxx | |
parent | ce684cd567eeb1dee211441a42689d299ee1da05 (diff) |
Factor reusable code to target_key::effective_name()
Diffstat (limited to 'libbuild2/adhoc-rule-regex-pattern.cxx')
-rw-r--r-- | libbuild2/adhoc-rule-regex-pattern.cxx | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/libbuild2/adhoc-rule-regex-pattern.cxx b/libbuild2/adhoc-rule-regex-pattern.cxx index 89a4766..b0de827 100644 --- a/libbuild2/adhoc-rule-regex-pattern.cxx +++ b/libbuild2/adhoc-rule-regex-pattern.cxx @@ -196,26 +196,17 @@ namespace build2 // string& ns (me.buffer); - auto append_name = [&ns, first = true] (const target_key& tk, - const element& e) mutable + auto append_name = [&ns, + first = true, + storage = string ()] (const target_key& tk, + const element& e) mutable { if (!first) ns += '/'; else first = false; - ns += *tk.name; - - // The same semantics as in variable_type_map::find(). - // - if (tk.ext && !tk.ext->empty () && - (e.match_ext || - tk.type->fixed_extension == &target_extension_none || - tk.type->fixed_extension == &target_extension_must)) - { - ns += '.'; - ns += *tk.ext; - } + ns += tk.effective_name (storage, e.match_ext); }; // Primary target (always a pattern). |