From 1b8bf35acc321b4f4e57195555cd21f1a5092095 Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 6 Oct 2018 01:49:34 +0300 Subject: [PATCH] Micro optimize: don't init log_msg.msg_id on construction. It will be set anyway later --- include/spdlog/details/log_msg.h | 2 +- include/spdlog/details/pattern_formatter.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index f94aa7f4..49987515 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -39,7 +39,7 @@ struct log_msg log_clock::time_point time; size_t thread_id; fmt::memory_buffer raw; - size_t msg_id{0}; + size_t msg_id; // info about wrapping the formatted text with color (updated by pattern_formatter). mutable size_t color_range_start{0}; diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h index 4f123b6d..14fb124c 100644 --- a/include/spdlog/details/pattern_formatter.h +++ b/include/spdlog/details/pattern_formatter.h @@ -714,11 +714,11 @@ private: case ('P'): formatters_.push_back(details::make_unique()); break; - +#ifdef SPDLOG_ENABLE_MESSAGE_COUNTER case ('i'): formatters_.push_back(details::make_unique()); break; - +#endif case ('^'): formatters_.push_back(details::make_unique()); break;