From 887326e715e4e2025e264040e6ee78ea79f10f2b Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 8 Jul 2018 01:41:32 +0300 Subject: [PATCH] minor code cleanup --- include/spdlog/common.h | 4 ++-- include/spdlog/details/pattern_formatter.h | 12 ++++-------- include/spdlog/sinks/sink.h | 12 +----------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 9e0697b2..521ee1e3 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -127,8 +127,8 @@ using level_hasher = std::hash; // enum class async_overflow_policy { - block, // Block until message can be enqueued - overrun_oldest // Discard oldest message in the queue if full when trying to add new item. + block, // Block until message can be enqueued + overrun_oldest // Discard oldest message in the queue if full when trying to add new item. }; // diff --git a/include/spdlog/details/pattern_formatter.h b/include/spdlog/details/pattern_formatter.h index a5ebe923..02c749f7 100644 --- a/include/spdlog/details/pattern_formatter.h +++ b/include/spdlog/details/pattern_formatter.h @@ -329,23 +329,19 @@ public: int total_minutes = os::utc_minutes_offset(tm_time); #endif bool is_negative = total_minutes < 0; - char sign; if (is_negative) { total_minutes = -total_minutes; - sign = '-'; + dest.push_back('-'); } else { - sign = '+'; + dest.push_back('+'); } - int h = total_minutes / 60; - int m = total_minutes % 60; - dest.push_back(sign); - fmt_helper::pad2(h, dest); + fmt_helper::pad2(total_minutes / 60, dest); //hours dest.push_back(':'); - fmt_helper::pad2(m, dest); + fmt_helper::pad2(total_minutes % 60, dest); //minutes } private: diff --git a/include/spdlog/sinks/sink.h b/include/spdlog/sinks/sink.h index 39eb0abb..bc044f3d 100644 --- a/include/spdlog/sinks/sink.h +++ b/include/spdlog/sinks/sink.h @@ -19,17 +19,7 @@ public: : formatter_(std::unique_ptr(new pattern_formatter("%+"))) { } - // - // explicit sink(const std::string &formatter_pattern) - // : formatter_(std::unique_ptr(new pattern_formatter(formatter_pattern))) - // { - // } - // - // // sink with custom formatter - // explicit sink(std::unique_ptr sink_formatter) - // : formatter_(std::move(sink_formatter)) - // { - // } + virtual ~sink() = default;