mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
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:
parent
37cbd98e34
commit
763afe6f5f
1 changed files with 2 additions and 1 deletions
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue