Skip to content

Commit

Permalink
Revert 01dac45
Browse files Browse the repository at this point in the history
  • Loading branch information
gabime authored May 20, 2020
1 parent 01dac45 commit ad393b8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions include/spdlog/sinks/ringbuffer_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class ringbuffer_sink final : public base_sink<Mutex>
std::vector<details::log_msg_buffer> last_raw(size_t lim = 0)
{
std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
auto items_available = q_.size();
auto n_items = lim > 0 ? (std::min)(lim, items_available) : items_available;
auto n_items = lim > 0 ? (std::min)(lim, q_.size()) : q_.size();
std::vector<details::log_msg_buffer> ret;
ret.reserve(n_items);
for (size_t i = (items_available - n_items); i < items_available; i++)
for (size_t i = 0; i < n_items; i++)
{
ret.push_back(q_.at(i));
}
Expand All @@ -42,11 +41,10 @@ class ringbuffer_sink final : public base_sink<Mutex>
std::vector<std::string> last_formatted(size_t lim = 0)
{
std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
auto items_available = q_.size();
auto n_items = lim > 0 ? (std::min)(lim, items_available) : items_available;
auto n_items = lim > 0 ? (std::min)(lim, q_.size()) : q_.size();
std::vector<std::string> ret;
ret.reserve(n_items);
for (size_t i = (items_available - n_items); i < items_available; i++)
for (size_t i = 0; i < n_items; i++)
{
memory_buf_t formatted;
base_sink<Mutex>::formatter_->format(q_.at(i), formatted);
Expand Down

0 comments on commit ad393b8

Please sign in to comment.