readability-else-after-return

This commit is contained in:
Daniel Chabrowski 2018-02-25 00:24:47 +01:00
parent 9ebb9ff318
commit d5a3bb5234
4 changed files with 11 additions and 17 deletions

View File

@ -328,14 +328,11 @@ inline bool spdlog::details::async_log_helper::process_next_msg(log_clock::time_
// Handle empty queue.. // Handle empty queue..
// This is the only place where the queue can terminate or flush to avoid losing messages already in the queue // This is the only place where the queue can terminate or flush to avoid losing messages already in the queue
else
{
auto now = details::os::now(); auto now = details::os::now();
handle_flush_interval(now, last_flush); handle_flush_interval(now, last_flush);
sleep_or_yield(now, last_pop); sleep_or_yield(now, last_pop);
return !_terminate_requested; return !_terminate_requested;
} }
}
// flush all sinks if _flush_interval_ms has expired // flush all sinks if _flush_interval_ms has expired
inline void spdlog::details::async_log_helper::handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush) inline void spdlog::details::async_log_helper::handle_flush_interval(log_clock::time_point& now, log_clock::time_point& last_flush)

View File

@ -403,11 +403,8 @@ inline std::string errno_to_string(char buf[256], int res)
{ {
return std::string(buf); return std::string(buf);
} }
else
{
return "Unknown error"; return "Unknown error";
} }
}
// Return errno string (thread safe) // Return errno string (thread safe)
inline std::string errno_str(int err_num) inline std::string errno_str(int err_num)

View File

@ -662,9 +662,9 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
inline std::tm spdlog::pattern_formatter::get_time(details::log_msg& msg) inline std::tm spdlog::pattern_formatter::get_time(details::log_msg& msg)
{ {
if (_pattern_time == pattern_time_type::local) if (_pattern_time == pattern_time_type::local) {
return details::os::localtime(log_clock::to_time_t(msg.time)); return details::os::localtime(log_clock::to_time_t(msg.time));
else }
return details::os::gmtime(log_clock::to_time_t(msg.time)); return details::os::gmtime(log_clock::to_time_t(msg.time));
} }

View File

@ -236,9 +236,9 @@ private:
date.tm_min = _rotation_m; date.tm_min = _rotation_m;
date.tm_sec = 0; date.tm_sec = 0;
auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date)); auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date));
if (rotation_time > now) if (rotation_time > now) {
return rotation_time; return rotation_time;
else }
return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24)); return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24));
} }