From be5b726c0a99e3685abb296d0adbfcccf45a0aa8 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 12 Sep 2017 16:55:10 +0200
Subject: [PATCH] util/StringView: remove Literal()

This is not necessary, because a strlen() on a literal gets optimized
away by the compiler.
---
 src/db/plugins/upnp/Directory.cxx |  4 ++--
 src/util/StringView.hxx           | 20 --------------------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/src/db/plugins/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx
index d82cdcbae..e6e3b0043 100644
--- a/src/db/plugins/upnp/Directory.cxx
+++ b/src/db/plugins/upnp/Directory.cxx
@@ -41,9 +41,9 @@ gcc_pure
 static UPnPDirObject::ItemClass
 ParseItemClass(StringView name) noexcept
 {
-	if (name.EqualsLiteral("object.item.audioItem.musicTrack"))
+	if (name.Equals("object.item.audioItem.musicTrack"))
 		return UPnPDirObject::ItemClass::MUSIC;
-	else if (name.EqualsLiteral("object.item.playlistItem"))
+	else if (name.Equals("object.item.playlistItem"))
 		return UPnPDirObject::ItemClass::PLAYLIST;
 	else
 		return UPnPDirObject::ItemClass::UNKNOWN;
diff --git a/src/util/StringView.hxx b/src/util/StringView.hxx
index 630230b92..8a7edc090 100644
--- a/src/util/StringView.hxx
+++ b/src/util/StringView.hxx
@@ -54,16 +54,6 @@ struct StringView : ConstBuffer<char> {
 		return StringView("", size_t(0));
 	}
 
-	template<size_t n>
-	static constexpr StringView Literal(const char (&_data)[n]) noexcept {
-		static_assert(n > 0, "");
-		return {_data, n - 1};
-	}
-
-	static constexpr StringView Literal() noexcept {
-		return StringView("", size_t(0));
-	}
-
 	void SetEmpty() noexcept {
 		data = "";
 		size = 0;
@@ -105,22 +95,12 @@ struct StringView : ConstBuffer<char> {
 			memcmp(data, other.data, size) == 0;
 	}
 
-	template<size_t n>
-	bool EqualsLiteral(const char (&other)[n]) const noexcept {
-		return Equals(Literal(other));
-	}
-
 	gcc_pure
 	bool EqualsIgnoreCase(StringView other) const noexcept {
 		return size == other.size &&
 			strncasecmp(data, other.data, size) == 0;
 	}
 
-	template<size_t n>
-	bool EqualsLiteralIgnoreCase(const char (&other)[n]) const noexcept {
-		return EqualsIgnoreCase(Literal(other));
-	}
-
 	/**
 	 * Skip all whitespace at the beginning.
 	 */