util/AllocatedString: remove Null(), IsNull()
This commit is contained in:
		| @@ -29,7 +29,7 @@ | |||||||
| NarrowPath::NarrowPath(Path _path) noexcept | NarrowPath::NarrowPath(Path _path) noexcept | ||||||
| 	:value(WideCharToMultiByte(CP_ACP, _path.c_str())) | 	:value(WideCharToMultiByte(CP_ACP, _path.c_str())) | ||||||
| { | { | ||||||
| 	if (value.IsNull()) | 	if (value == nullptr) | ||||||
| 		/* fall back to empty string */ | 		/* fall back to empty string */ | ||||||
| 		value = Value::Empty(); | 		value = Value::Empty(); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ IcuCompare::operator==(const char *haystack) const noexcept | |||||||
| #ifdef HAVE_ICU_CASE_FOLD | #ifdef HAVE_ICU_CASE_FOLD | ||||||
| 	return StringIsEqual(IcuCaseFold(haystack).c_str(), needle.c_str()); | 	return StringIsEqual(IcuCaseFold(haystack).c_str(), needle.c_str()); | ||||||
| #elif defined(_WIN32) | #elif defined(_WIN32) | ||||||
| 	if (needle.IsNull()) | 	if (needle == nullptr) | ||||||
| 		/* the MultiByteToWideChar() call in the constructor | 		/* the MultiByteToWideChar() call in the constructor | ||||||
| 		   has failed, so let's always fail the comparison */ | 		   has failed, so let's always fail the comparison */ | ||||||
| 		return false; | 		return false; | ||||||
| @@ -83,7 +83,7 @@ IcuCompare::IsIn(const char *haystack) const noexcept | |||||||
| 	return StringFind(IcuCaseFold(haystack).c_str(), | 	return StringFind(IcuCaseFold(haystack).c_str(), | ||||||
| 			  needle.c_str()) != nullptr; | 			  needle.c_str()) != nullptr; | ||||||
| #elif defined(_WIN32) | #elif defined(_WIN32) | ||||||
| 	if (needle.IsNull()) | 	if (needle == nullptr) | ||||||
| 		/* the MultiByteToWideChar() call in the constructor | 		/* the MultiByteToWideChar() call in the constructor | ||||||
| 		   has failed, so let's always fail the comparison */ | 		   has failed, so let's always fail the comparison */ | ||||||
| 		return false; | 		return false; | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ public: | |||||||
|  |  | ||||||
| 	gcc_pure | 	gcc_pure | ||||||
| 	operator bool() const noexcept { | 	operator bool() const noexcept { | ||||||
| 		return !needle.IsNull(); | 		return needle != nullptr; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	gcc_pure | 	gcc_pure | ||||||
|   | |||||||
| @@ -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, ""); | 	const auto icy_string = icy_server_metadata_string(stream_title, ""); | ||||||
|  |  | ||||||
| 	if (icy_string.IsNull()) | 	if (icy_string == nullptr) | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
|  |  | ||||||
| 	return std::make_shared<Page>(icy_string.c_str(), | 	return std::make_shared<Page>(icy_string.c_str(), | ||||||
|   | |||||||
| @@ -85,10 +85,6 @@ public: | |||||||
| 		return BasicAllocatedString(value); | 		return BasicAllocatedString(value); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	static BasicAllocatedString Null() noexcept { |  | ||||||
| 		return nullptr; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	static BasicAllocatedString Empty() { | 	static BasicAllocatedString Empty() { | ||||||
| 		auto p = new value_type[1]; | 		auto p = new value_type[1]; | ||||||
| 		p[0] = SENTINEL; | 		p[0] = SENTINEL; | ||||||
| @@ -120,10 +116,6 @@ public: | |||||||
| 		return value != nullptr; | 		return value != nullptr; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	constexpr bool IsNull() const noexcept { |  | ||||||
| 		return value == nullptr; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	operator string_view() const noexcept { | 	operator string_view() const noexcept { | ||||||
| 		return value != nullptr | 		return value != nullptr | ||||||
| 			? string_view(value) | 			? string_view(value) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann