util/AllocatedString: replace Clone() with copy constructor

This commit is contained in:
Max Kellermann
2021-01-14 13:43:42 +01:00
committed by Max Kellermann
parent 8d47f51399
commit c1a7aa652d
2 changed files with 9 additions and 10 deletions

View File

@@ -38,11 +38,11 @@ class IcuCompare {
#ifdef _WIN32
/* Windows API functions work with wchar_t strings, so let's
cache the MultiByteToWideChar() result for performance */
BasicAllocatedString<wchar_t> needle;
#else
AllocatedString needle;
using AllocatedString = BasicAllocatedString<wchar_t>;
#endif
AllocatedString needle;
public:
IcuCompare():needle(nullptr) {}
@@ -50,12 +50,12 @@ public:
IcuCompare(const IcuCompare &src) noexcept
:needle(src
? src.needle.Clone()
? AllocatedString(src.needle)
: nullptr) {}
IcuCompare &operator=(const IcuCompare &src) noexcept {
needle = src
? src.needle.Clone()
? AllocatedString(src.needle)
: nullptr;
return *this;
}