util: store std::string_view in "final_components" vector

Don't copy those path segments - instead, use std::string_view to
store references into the existing std::strings.  This saves a good
amount of allocation overhead.
This commit is contained in:
Max Kellermann 2020-01-31 12:24:16 +01:00
parent 37cbd98e34
commit 763afe6f5f

View file

@ -1555,7 +1555,8 @@ TEST_CASE("util normalize_path")
string normalize_path(const std::string_view path)
{
size_t n;
vector<string> components, final_components;
vector<string> components;
vector<std::string_view> final_components;
string new_path;
new_path.reserve(path.size());