util/AllocatedString: add string_view constructor

Replaces the static Duplicate() method.
This commit is contained in:
Max Kellermann
2021-01-14 13:16:52 +01:00
committed by Max Kellermann
parent 1caf57644f
commit a81c9bfb81
5 changed files with 18 additions and 14 deletions

View File

@@ -469,7 +469,7 @@ Windows1252ToUTF8(const char *s) noexcept
* Fallback to not transcoding windows-1252 to utf-8, that may result
* in invalid utf-8 unless nonprintable characters are replaced.
*/
auto t = AllocatedString::Duplicate(s);
AllocatedString t(s);
for (size_t i = 0; t[i] != AllocatedString::SENTINEL; i++)
if (!IsPrintableASCII(t[i]))