Commit 32b7b2e2 authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

util/AllocatedString: add default constructor

parent cfb7f8ab
...@@ -88,7 +88,7 @@ IcuCollate(std::string_view a, std::string_view b) noexcept ...@@ -88,7 +88,7 @@ IcuCollate(std::string_view a, std::string_view b) noexcept
b.data(), b.size(), &code); b.data(), b.size(), &code);
#elif defined(_WIN32) #elif defined(_WIN32)
BasicAllocatedString<wchar_t> wa = nullptr, wb = nullptr; BasicAllocatedString<wchar_t> wa, wb;
try { try {
wa = MultiByteToWideChar(CP_UTF8, a); wa = MultiByteToWideChar(CP_UTF8, a);
......
...@@ -136,7 +136,7 @@ bool ...@@ -136,7 +136,7 @@ bool
HttpdClient::SendResponse() noexcept HttpdClient::SendResponse() noexcept
{ {
char buffer[1024]; char buffer[1024];
AllocatedString allocated = nullptr; AllocatedString allocated;
const char *response; const char *response;
assert(state == State::RESPONSE); assert(state == State::RESPONSE);
......
...@@ -55,12 +55,13 @@ public: ...@@ -55,12 +55,13 @@ public:
static constexpr value_type SENTINEL = '\0'; static constexpr value_type SENTINEL = '\0';
private: private:
pointer value; pointer value = nullptr;
explicit BasicAllocatedString(pointer _value) noexcept explicit BasicAllocatedString(pointer _value) noexcept
:value(_value) {} :value(_value) {}
public: public:
BasicAllocatedString() noexcept = default;
BasicAllocatedString(std::nullptr_t n) noexcept BasicAllocatedString(std::nullptr_t n) noexcept
:value(n) {} :value(n) {}
...@@ -145,6 +146,7 @@ class AllocatedString : public BasicAllocatedString<char> { ...@@ -145,6 +146,7 @@ class AllocatedString : public BasicAllocatedString<char> {
public: public:
using BasicAllocatedString::BasicAllocatedString; using BasicAllocatedString::BasicAllocatedString;
AllocatedString() noexcept = default;
AllocatedString(BasicAllocatedString<value_type> &&src) noexcept AllocatedString(BasicAllocatedString<value_type> &&src) noexcept
:BasicAllocatedString(std::move(src)) {} :BasicAllocatedString(std::move(src)) {}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment