diff options
author | Max Kellermann <mk@cm4all.com> | 2021-01-14 13:02:30 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-03-04 18:04:06 +0100 |
commit | 32b7b2e2fa1d2acbadea0390b63872451591ff5b (patch) | |
tree | 36a8fc26cd864c29e641c764466b09f6d887a5e0 /src | |
parent | cfb7f8ab84ca4c2d6d2f2826f893992c27a7f591 (diff) |
util/AllocatedString: add default constructor
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/icu/Collate.cxx | 2 | ||||
-rw-r--r-- | src/output/plugins/httpd/HttpdClient.cxx | 2 | ||||
-rw-r--r-- | src/util/AllocatedString.hxx | 4 |
3 files changed, 5 insertions, 3 deletions
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<wchar_t> wa = nullptr, wb = nullptr; + BasicAllocatedString<wchar_t> 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<char> { public: using BasicAllocatedString::BasicAllocatedString; + AllocatedString() noexcept = default; AllocatedString(BasicAllocatedString<value_type> &&src) noexcept :BasicAllocatedString(std::move(src)) {} }; |