Updated ringbuffer sink

This commit is contained in:
gabime
2019-11-10 00:08:50 +02:00
parent cff6644b28
commit 0cb38085a1
4 changed files with 65 additions and 44 deletions

View File

@@ -77,11 +77,11 @@ public:
{
if (tail_ >= head_)
{
return tail_ - head_;
return tail_ - head_;
}
else
{
return max_items_ - (head_ - tail_ );
return max_items_ - (head_ - tail_);
}
}
@@ -90,7 +90,7 @@ public:
const T &at(size_t i) const
{
assert(i < size());
return v_[(head_+ i) % max_items_];
return v_[(head_ + i) % max_items_];
}
// Pop item from front.

View File

@@ -26,9 +26,7 @@ SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
update_string_views();
}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT
: log_msg{other}
, buffer{std::move(other.buffer)}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)}
{
update_string_views();
}