From 34a6c0d2e966f7240ae9c810c107d1109d407032 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Tue, 5 Nov 2024 10:04:50 +0000 Subject: [PATCH] chore(libsinsp): avoid useless allocation Signed-off-by: Roberto Scolaro --- userspace/libsinsp/utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/libsinsp/utils.cpp b/userspace/libsinsp/utils.cpp index 4ed6a87a19..05b38272b5 100644 --- a/userspace/libsinsp/utils.cpp +++ b/userspace/libsinsp/utils.cpp @@ -1264,13 +1264,13 @@ std::vector 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;