Commit f76cd93a authored by louiz’'s avatar louiz’

Fix clang warnings on some utils function. It’s also faster

parent c671da13
......@@ -7,17 +7,11 @@
namespace utils
{
inline std::string empty_if_fixed_server(std::string&& str)
inline const std::string& empty_if_fixed_server(const std::string& str)
{
static const std::string empty{};
if (!Config::get("fixed_irc_server", "").empty())
return {};
return std::move(str);
}
inline std::string empty_if_fixed_server(const std::string& str)
{
if (!Config::get("fixed_irc_server", "").empty())
return {};
return empty;
return str;
}
......
......@@ -6,13 +6,13 @@ bool is_empty(const std::string& val);
bool is_empty(const int& val);
template <typename T>
T get_first_non_empty(T&& last)
T& get_first_non_empty(T&& last)
{
return last;
}
template <typename T, typename... Args>
T get_first_non_empty(T&& first, Args&&... args)
T& get_first_non_empty(T&& first, Args&&... args)
{
if (!is_empty(first))
return first;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment