diff --git a/src/lib/icu/Collate.cxx b/src/lib/icu/Collate.cxx index c31f46883..54d226895 100644 --- a/src/lib/icu/Collate.cxx +++ b/src/lib/icu/Collate.cxx @@ -88,7 +88,7 @@ IcuCollate(std::string_view a, std::string_view b) noexcept b.data(), b.size(), &code); #elif defined(_WIN32) - BasicAllocatedString wa = nullptr, wb = nullptr; + BasicAllocatedString wa, wb; try { wa = MultiByteToWideChar(CP_UTF8, a); diff --git a/src/output/plugins/httpd/HttpdClient.cxx b/src/output/plugins/httpd/HttpdClient.cxx index 36e9b3abc..8a88b131d 100644 --- a/src/output/plugins/httpd/HttpdClient.cxx +++ b/src/output/plugins/httpd/HttpdClient.cxx @@ -136,7 +136,7 @@ bool HttpdClient::SendResponse() noexcept { char buffer[1024]; - AllocatedString allocated = nullptr; + AllocatedString allocated; const char *response; assert(state == State::RESPONSE); diff --git a/src/util/AllocatedString.hxx b/src/util/AllocatedString.hxx index 3c9a7b9b9..2a5aaa02d 100644 --- a/src/util/AllocatedString.hxx +++ b/src/util/AllocatedString.hxx @@ -55,12 +55,13 @@ public: static constexpr value_type SENTINEL = '\0'; private: - pointer value; + pointer value = nullptr; explicit BasicAllocatedString(pointer _value) noexcept :value(_value) {} public: + BasicAllocatedString() noexcept = default; BasicAllocatedString(std::nullptr_t n) noexcept :value(n) {} @@ -145,6 +146,7 @@ class AllocatedString : public BasicAllocatedString { public: using BasicAllocatedString::BasicAllocatedString; + AllocatedString() noexcept = default; AllocatedString(BasicAllocatedString &&src) noexcept :BasicAllocatedString(std::move(src)) {} };