util/AllocatedString: remove Null(), IsNull()

This commit is contained in:
Max Kellermann 2021-01-21 20:07:14 +01:00
parent 67760f5283
commit dc9103befe
5 changed files with 5 additions and 13 deletions

View File

@ -29,7 +29,7 @@
NarrowPath::NarrowPath(Path _path) noexcept
:value(WideCharToMultiByte(CP_ACP, _path.c_str()))
{
if (value.IsNull())
if (value == nullptr)
/* fall back to empty string */
value = Value::Empty();
}

View File

@ -56,7 +56,7 @@ IcuCompare::operator==(const char *haystack) const noexcept
#ifdef HAVE_ICU_CASE_FOLD
return StringIsEqual(IcuCaseFold(haystack).c_str(), needle.c_str());
#elif defined(_WIN32)
if (needle.IsNull())
if (needle == nullptr)
/* the MultiByteToWideChar() call in the constructor
has failed, so let's always fail the comparison */
return false;
@ -83,7 +83,7 @@ IcuCompare::IsIn(const char *haystack) const noexcept
return StringFind(IcuCaseFold(haystack).c_str(),
needle.c_str()) != nullptr;
#elif defined(_WIN32)
if (needle.IsNull())
if (needle == nullptr)
/* the MultiByteToWideChar() call in the constructor
has failed, so let's always fail the comparison */
return false;

View File

@ -65,7 +65,7 @@ public:
gcc_pure
operator bool() const noexcept {
return !needle.IsNull();
return needle != nullptr;
}
gcc_pure

View File

@ -110,7 +110,7 @@ icy_server_metadata_page(const Tag &tag, const TagType *types) noexcept
const auto icy_string = icy_server_metadata_string(stream_title, "");
if (icy_string.IsNull())
if (icy_string == nullptr)
return nullptr;
return std::make_shared<Page>(icy_string.c_str(),

View File

@ -85,10 +85,6 @@ public:
return BasicAllocatedString(value);
}
static BasicAllocatedString Null() noexcept {
return nullptr;
}
static BasicAllocatedString Empty() {
auto p = new value_type[1];
p[0] = SENTINEL;
@ -120,10 +116,6 @@ public:
return value != nullptr;
}
constexpr bool IsNull() const noexcept {
return value == nullptr;
}
operator string_view() const noexcept {
return value != nullptr
? string_view(value)