mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
util: don't modify the input string in tokenize_string()
This saves one full copy of the input string and avoids moving memory around at O(n^2) in the erase() call in each loop iteration.
This commit is contained in:
parent
70b45d1aba
commit
e068ad8a53
2 changed files with 7 additions and 6 deletions
|
@ -145,7 +145,7 @@ inline std::string get_escaped_string(const std::string& str, bool escape_all)
|
|||
return get_escaped_string(str.data(), str.length(), escape_all);
|
||||
}
|
||||
|
||||
std::vector<std::string>* tokenize_string(std::string input,
|
||||
std::vector<std::string>* tokenize_string(const std::string &input,
|
||||
const std::string& delim,
|
||||
std::vector<std::string>* rval = 0, int limit = 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue