From dc9103befecf6056b0a75e569de030acc847f4a9 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Thu, 21 Jan 2021 20:07:14 +0100
Subject: [PATCH] util/AllocatedString: remove Null(), IsNull()

---
 src/fs/NarrowPath.cxx                          | 2 +-
 src/lib/icu/Compare.cxx                        | 4 ++--
 src/lib/icu/Compare.hxx                        | 2 +-
 src/output/plugins/httpd/IcyMetaDataServer.cxx | 2 +-
 src/util/AllocatedString.hxx                   | 8 --------
 5 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/fs/NarrowPath.cxx b/src/fs/NarrowPath.cxx
index fec228f9d..e9655d7f8 100644
--- a/src/fs/NarrowPath.cxx
+++ b/src/fs/NarrowPath.cxx
@@ -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();
 }
diff --git a/src/lib/icu/Compare.cxx b/src/lib/icu/Compare.cxx
index dfc5d2210..60265dd10 100644
--- a/src/lib/icu/Compare.cxx
+++ b/src/lib/icu/Compare.cxx
@@ -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;
diff --git a/src/lib/icu/Compare.hxx b/src/lib/icu/Compare.hxx
index 3110d16aa..88e2e0711 100644
--- a/src/lib/icu/Compare.hxx
+++ b/src/lib/icu/Compare.hxx
@@ -65,7 +65,7 @@ public:
 
 	gcc_pure
 	operator bool() const noexcept {
-		return !needle.IsNull();
+		return needle != nullptr;
 	}
 
 	gcc_pure
diff --git a/src/output/plugins/httpd/IcyMetaDataServer.cxx b/src/output/plugins/httpd/IcyMetaDataServer.cxx
index 6e4a0d24d..d746d0a0a 100644
--- a/src/output/plugins/httpd/IcyMetaDataServer.cxx
+++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx
@@ -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(),
diff --git a/src/util/AllocatedString.hxx b/src/util/AllocatedString.hxx
index 2ca1218c9..27c047514 100644
--- a/src/util/AllocatedString.hxx
+++ b/src/util/AllocatedString.hxx
@@ -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)