Init cached_tm with {}

This commit is contained in:
gabime 2024-01-13 10:33:08 +02:00
parent f70670d26c
commit e2e8099ad9

View File

@ -832,24 +832,24 @@ pattern_formatter::pattern_formatter(std::string pattern,
pattern_time_type time_type, pattern_time_type time_type,
std::string eol, std::string eol,
custom_flags custom_user_flags) custom_flags custom_user_flags)
: pattern_(std::move(pattern)), : pattern_{std::move(pattern)},
eol_(std::move(eol)), eol_{std::move(eol)},
pattern_time_type_(time_type), pattern_time_type_{time_type},
need_localtime_(false), need_localtime_{false},
last_log_secs_(0), cached_tm_{},
custom_handlers_(std::move(custom_user_flags)) { last_log_secs_{0},
std::memset(&cached_tm_, 0, sizeof(cached_tm_)); custom_handlers_{std::move(custom_user_flags)} {
compile_pattern_(pattern_); compile_pattern_(pattern_);
} }
// use by default full formatter for if pattern is not given // use by default full formatter for if pattern is not given
pattern_formatter::pattern_formatter(pattern_time_type time_type, std::string eol) pattern_formatter::pattern_formatter(pattern_time_type time_type, std::string eol)
: pattern_("%+"), : pattern_{"%+"},
eol_(std::move(eol)), eol_{std::move(eol)},
pattern_time_type_(time_type), pattern_time_type_{time_type},
need_localtime_(true), need_localtime_{true},
last_log_secs_(0) { cached_tm_{},
std::memset(&cached_tm_, 0, sizeof(cached_tm_)); last_log_secs_{0} {
formatters_.push_back(std::make_unique<details::full_formatter>(details::padding_info{})); formatters_.push_back(std::make_unique<details::full_formatter>(details::padding_info{}));
} }