Skip to content

Commit

Permalink
charset: elimninate class Utf8ToLocaleZ
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 14, 2024
1 parent f7dd0f3 commit 24954b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
2 changes: 1 addition & 1 deletion src/FileListPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions src/charset.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 24954b3

Please sign in to comment.