From 6a242a8050edd0a33ea0e770a6eca4823a98b8d1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 6 Jan 2022 06:59:31 +0200 Subject: Factor reusable code to target_key::effective_name() --- libbuild2/adhoc-rule-regex-pattern.cxx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'libbuild2/adhoc-rule-regex-pattern.cxx') 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). -- cgit v1.1