Address PR review comments

This commit is contained in:
Charles Milette
2022-04-25 21:59:56 -04:00
parent 714cf12822
commit 37dd6bb159
4 changed files with 13 additions and 12 deletions

View File

@@ -25,13 +25,13 @@ inline spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEX
#ifdef SPDLOG_USE_STD_FORMAT
template<typename T>
std::basic_string<T> to_string(const std::basic_string<T> &buf)
std::basic_string<T> to_string(std::basic_string<T> &&buf)
{
return buf;
return std::move(buf);
}
#else
template<typename T, size_t Size>
std::basic_string<T> to_string(const fmt::basic_memory_buffer<T, Size> &buf)
std::basic_string<T> to_string(fmt::basic_memory_buffer<T, Size> &&buf)
{
return fmt::to_string(buf);
}

View File

@@ -389,7 +389,7 @@ SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
{
memory_buf_t buf;
wstr_to_utf8buf(filename, buf);
return fmt_helper::to_string(buf);
return fmt_helper::to_string(std::move(buf));
}
#else
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)

View File

@@ -5,6 +5,7 @@
#include "spdlog/sinks/base_sink.h"
#include "spdlog/details/circular_q.h"
#include "spdlog/details/fmt_helper.h"
#include "spdlog/details/log_msg_buffer.h"
#include "spdlog/details/null_mutex.h"
@@ -50,7 +51,7 @@ public:
{
memory_buf_t formatted;
base_sink<Mutex>::formatter_->format(q_.at(i), formatted);
ret.push_back(fmt_helper::to_string(formatted));
ret.push_back(details::fmt_helper::to_string(std::move(formatted)));
}
return ret;
}