mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 08:31:03 +08:00
Fix valgrind warning about uninitialized variable use in to_stream()
tm variable is not initialized in to_stream(), and valgrind warns about "Conditional jump or move depends on uninitialised value(s)". This is a false positive, as strftime always reads tm_hour, even if it ends up never using it. To silence the warnings, initialize tm to zero.
This commit is contained in:
parent
2e213abb76
commit
2032fccbb7
@ -4566,7 +4566,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
|
|||||||
{
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
tm tm;
|
tm tm{};
|
||||||
#if !ONLY_C_LOCALE
|
#if !ONLY_C_LOCALE
|
||||||
auto& facet = use_facet<time_put<CharT>>(os.getloc());
|
auto& facet = use_facet<time_put<CharT>>(os.getloc());
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user