util/AllocatedString: add default constructor

This commit is contained in:
Max Kellermann 2021-01-14 13:02:30 +01:00 committed by Max Kellermann
parent cfb7f8ab84
commit 32b7b2e2fa
3 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -136,7 +136,7 @@ bool
HttpdClient::SendResponse() noexcept
{
char buffer[1024];
AllocatedString allocated = nullptr;
AllocatedString allocated;
const char *response;
assert(state == State::RESPONSE);

View File

@ -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)) {}
};