From e0009216ee830e8da023047ed6fe187f48f612d1 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 20 Jan 2025 21:28:25 +0100 Subject: Don't return const ref strings in ctor::configuration::get. Instead return std::string by copy. --- test/tools_test.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'test/tools_test.cc') diff --git a/test/tools_test.cc b/test/tools_test.cc index a428ea1..46ab084 100644 --- a/test/tools_test.cc +++ b/test/tools_test.cc @@ -114,33 +114,27 @@ bool operator!=(const ctor::asm_flag& a, const ctor::asm_flag& b) #include -namespace { -std::string conf_host_cxx{}; -std::string conf_build_cxx{}; -} - const ctor::configuration& ctor::get_configuration() { static ctor::configuration cfg; return cfg; } -const std::string& ctor::configuration::get(const std::string& key, const std::string& defval) const +std::string ctor::configuration::get(const std::string& key, [[maybe_unused]]const std::string& default_value) const { if(key == ctor::cfg::host_cxx) { - return conf_host_cxx; + return {}; } if(key == ctor::cfg::build_cxx) { - return conf_build_cxx; + return {}; } assert(false); // bad key - static std::string res{}; - return res; + return {}; } class ToolsTest -- cgit v1.2.3