diff options
author | Max Kellermann <max@duempel.org> | 2015-02-08 17:52:01 +0000 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-08 17:52:01 +0000 |
commit | 975e275030b467af7abc1c8465f55513f4cc3aa0 (patch) | |
tree | 21816bbe65b503c97ce130737fcfd7bd888c9b3a | |
parent | afcd5670e35d1ea00efb3458258df6497739ab1d (diff) | |
download | mpd-975e275030b467af7abc1c8465f55513f4cc3aa0.tar.gz mpd-975e275030b467af7abc1c8465f55513f4cc3aa0.tar.xz mpd-975e275030b467af7abc1c8465f55513f4cc3aa0.zip |
fs/Charset: change FixSeparators() API to use std::string&&
-rw-r--r-- | src/fs/Charset.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx index cbfe6ea3e..5532a2cb6 100644 --- a/src/fs/Charset.cxx +++ b/src/fs/Charset.cxx @@ -73,7 +73,8 @@ GetFSCharset() #endif } -static inline void FixSeparators(std::string &s) +static inline std::string && +FixSeparators(std::string &&s) { #ifdef WIN32 // For whatever reason GCC can't convert constexpr to value reference. @@ -81,9 +82,8 @@ static inline void FixSeparators(std::string &s) auto from = PathTraitsFS::SEPARATOR; auto to = PathTraitsUTF8::SEPARATOR; std::replace(s.begin(), s.end(), from, to); -#else - (void)s; #endif + return std::move(s); } std::string @@ -95,17 +95,12 @@ PathToUTF8(const char *path_fs) #endif #ifdef HAVE_FS_CHARSET - if (fs_converter == nullptr) { + if (fs_converter == nullptr) #endif - auto result = std::string(path_fs); - FixSeparators(result); - return result; + return FixSeparators(path_fs); #ifdef HAVE_FS_CHARSET - } - auto result_path = fs_converter->ToUTF8(path_fs); - FixSeparators(result_path); - return result_path; + return FixSeparators(fs_converter->ToUTF8(path_fs)); #endif } |