Skip to content

Commit

Permalink
chore(libsinsp): avoid useless allocation
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Nov 7, 2024
1 parent ded875b commit 34a6c0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions userspace/libsinsp/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,13 +1264,13 @@ std::vector<std::string> sinsp_split(std::string_view sv, char delim) {
std::string_view::size_type start = 0;
for(std::string_view::size_type i = 0; i < sv.size(); i++) {
if(sv[i] == delim) {
res.push_back(std::string(sv.substr(start, i - start)));
res.emplace_back(sv.substr(start, i - start));
start = i + 1;
}
}

if(start <= sv.length()) {
res.push_back(std::string(sv.substr(start)));
res.emplace_back(sv.substr(start));
}

return res;
Expand Down

0 comments on commit 34a6c0d

Please sign in to comment.