Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: use std::move() where appropriate
Suggested by Coverity: ``` Error: COPY_INSTEAD_OF_MOVE: src/lib/filter.cc:114:25: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/filter.cc:114:25: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/filter.cc:205:29: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::set<DefEvent, std::less<DefEvent>, std::allocator<DefEvent> >::insert(std::set<DefEvent, std::less<DefEvent>, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/filter.cc:205:29: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-cov.cc:428:28: copy_constructor_call: "str" is copied and then passed-by-reference as parameter to STL insertion function "std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::insert(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type const &)", when it could be moved instead. src/lib/parser-cov.cc:428:28: remediation: Use "std::move(""str"")" instead of "str". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-gcc.cc:552:46: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-gcc.cc:552:46: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-gcc.cc:558:46: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-gcc.cc:558:46: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-sarif.cc:205:13: copy_assignment_call: "uri" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-json-sarif.cc:205:30: remediation: Use "std::move(""uri"")" instead of "uri". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-sarif.cc:250:32: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-json-sarif.cc:250:32: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-simple.cc:157:30: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-json-simple.cc:157:30: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-zap.cc:144:9: copy_assignment_call: "version" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-json-zap.cc:144:49: remediation: Use "std::move(""version"")" instead of "version". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-xml-valgrind.cc:61:9: copy_assignment_call: "argVal" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-xml-valgrind.cc:61:17: remediation: Use "std::move(""argVal"")" instead of "argVal". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-xml-valgrind.cc:227:32: copy_constructor_call: "noteEvt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-xml-valgrind.cc:227:32: remediation: Use "std::move(""noteEvt"")" instead of "noteEvt". ``` Related: #216
- Loading branch information