Commit 2722b8a3 authored by Max Kellermann's avatar Max Kellermann

db/upnp/Util: "emplace" items into the list

Reduce overhead.
parent fd754ff8
......@@ -107,15 +107,15 @@ stringToTokens(const std::string &str,
// Add token to the vector and adjust start
if (pos == std::string::npos) {
tokens.push_back(str.substr(startPos));
tokens.emplace_back(str, startPos);
break;
} else if (pos == startPos) {
// Dont' push empty tokens after first
if (tokens.empty())
tokens.push_back(std::string());
tokens.emplace_back();
startPos = ++pos;
} else {
tokens.push_back(str.substr(startPos, pos - startPos));
tokens.emplace_back(str, startPos, pos - startPos);
startPos = ++pos;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment