From 5a602aee196c58f0048cf813951070e018b43bfd Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Fri, 25 Apr 2025 12:29:36 +0200 Subject: [PATCH] MT#59962 DSMCoreModule: move instead of copy Fixes: Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE) copy_constructor_call: varname is passed-by-value as parameter to std::__cxx11::basic_string, std::allocator >::basic_string(std::__cxx11::basic_string, std::allocator > const &), when it could be moved instead. Do the move operation also for the rvalue beign assigned, as it is a locally allocated pair. Change-Id: Iba8e349f13c4f83bcd10e229fb101e7b26872f0e --- apps/dsm/DSMCoreModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 8861f875..874b62e5 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -1402,7 +1402,7 @@ EXEC_ACTION_START(SCDIAction) { string varname = lb->first.substr(varprefix.length()); if (varname.find(".") == string::npos) - var_struct[varname] = lb->second; + var_struct[std::move(varname)] = lb->second; else string2argarray(varname, lb->second, var_struct);