From 24954b3a7ee8ac2f61f04229c55203a30b8e709f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 14 Sep 2024 22:54:47 +0200 Subject: [PATCH] charset: elimninate class Utf8ToLocaleZ --- src/FileListPage.cxx | 2 +- src/charset.hxx | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/FileListPage.cxx b/src/FileListPage.cxx index 3cc6e7ed..dbb8cdfe 100644 --- a/src/FileListPage.cxx +++ b/src/FileListPage.cxx @@ -105,7 +105,7 @@ FileListPage::LoadPlaylist(struct mpdclient &c, if (mpd_run_load(connection, mpd_playlist_get_path(&playlist))) { const char *name = GetUriFilename(mpd_playlist_get_path(&playlist)); FmtAlert(_("Loading playlist '{}'"), - Utf8ToLocaleZ{name}.c_str()); + (std::string_view)Utf8ToLocale{name}); c.events |= MPD_IDLE_QUEUE; } else diff --git a/src/charset.hxx b/src/charset.hxx index f370d680..00044ba7 100644 --- a/src/charset.hxx +++ b/src/charset.hxx @@ -117,32 +117,10 @@ public: #ifdef HAVE_ICONV -using Utf8ToLocaleZ = Utf8ToLocale; using LocaleToUtf8Z = LocaleToUtf8; #else -/** - * Like #Utf8ToLocaleZ, but return a null-terminated string. - */ -class Utf8ToLocaleZ { - const char *const value; - -public: - [[nodiscard]] - explicit constexpr Utf8ToLocaleZ(const char *src) noexcept - :value(src) {} - - [[nodiscard]] - explicit Utf8ToLocaleZ(const std::string &src) noexcept - :Utf8ToLocaleZ(src.c_str()) {} - - [[nodiscard]] [[gnu::pure]] - constexpr const char *c_str() const noexcept { - return value; - } -}; - /** * Like #LocaleToUtf8Z, but return a null-terminated string. */