Prevent copies in various places

This commit is contained in:
Benjamin Bannier 2025-01-13 10:01:16 +01:00
parent 8931c352ef
commit 2fd20f71ad
2 changed files with 8 additions and 8 deletions

View file

@ -93,7 +93,7 @@ Driver::Driver(std::unique_ptr<GlueCompiler> glue, const char* argv0, hilti::rt:
// We make our search paths relative to the plugin library, so that the // We make our search paths relative to the plugin library, so that the
// plugin installation can move around. // plugin installation can move around.
options.library_paths.push_back(lib_path); options.library_paths.push_back(std::move(lib_path));
} catch ( const hilti::rt::filesystem::filesystem_error& e ) { } catch ( const hilti::rt::filesystem::filesystem_error& e ) {
::hilti::logger().warning( ::hilti::logger().warning(
hilti::util::fmt("invalid plugin base directory %s: %s", lib_path.native(), e.what())); hilti::util::fmt("invalid plugin base directory %s: %s", lib_path.native(), e.what()));

View file

@ -479,19 +479,19 @@ bool GlueCompiler::loadEvtFile(hilti::rt::filesystem::path& path) {
if ( looking_at(*chunk, 0, "protocol") ) { if ( looking_at(*chunk, 0, "protocol") ) {
auto a = parseProtocolAnalyzer(*chunk); auto a = parseProtocolAnalyzer(*chunk);
SPICY_DEBUG(hilti::util::fmt(" Got protocol analyzer definition for %s", a.name)); SPICY_DEBUG(hilti::util::fmt(" Got protocol analyzer definition for %s", a.name));
_protocol_analyzers.push_back(a); _protocol_analyzers.push_back(std::move(a));
} }
else if ( looking_at(*chunk, 0, "file") ) { else if ( looking_at(*chunk, 0, "file") ) {
auto a = parseFileAnalyzer(*chunk); auto a = parseFileAnalyzer(*chunk);
SPICY_DEBUG(hilti::util::fmt(" Got file analyzer definition for %s", a.name)); SPICY_DEBUG(hilti::util::fmt(" Got file analyzer definition for %s", a.name));
_file_analyzers.push_back(a); _file_analyzers.push_back(std::move(a));
} }
else if ( looking_at(*chunk, 0, "packet") ) { else if ( looking_at(*chunk, 0, "packet") ) {
auto a = parsePacketAnalyzer(*chunk); auto a = parsePacketAnalyzer(*chunk);
SPICY_DEBUG(hilti::util::fmt(" Got packet analyzer definition for %s", a.name)); SPICY_DEBUG(hilti::util::fmt(" Got packet analyzer definition for %s", a.name));
_packet_analyzers.push_back(a); _packet_analyzers.push_back(std::move(a));
} }
else if ( looking_at(*chunk, 0, "on") ) { else if ( looking_at(*chunk, 0, "on") ) {
@ -562,7 +562,7 @@ bool GlueCompiler::loadEvtFile(hilti::rt::filesystem::path& path) {
} }
for ( auto&& ev : new_events ) for ( auto&& ev : new_events )
_events.push_back(ev); _events.push_back(std::move(ev));
return true; return true;
} }
@ -879,7 +879,7 @@ glue::Event GlueCompiler::parseEvent(const std::string& chunk) {
eat_token(chunk, &i, ","); eat_token(chunk, &i, ",");
auto expr = extract_expr(chunk, &i); auto expr = extract_expr(chunk, &i);
ev.exprs.push_back(expr); ev.exprs.push_back(std::move(expr));
first = false; first = false;
} }
@ -945,7 +945,7 @@ glue::Export GlueCompiler::parseExport(const std::string& chunk) {
if ( looking_at(chunk, i, "&log") ) { if ( looking_at(chunk, i, "&log") ) {
eat_token(chunk, &i, "&log"); eat_token(chunk, &i, "&log");
export_.logs.insert(field); export_.logs.insert(std::move(field));
} }
if ( looking_at(chunk, i, "}") ) { if ( looking_at(chunk, i, "}") ) {
@ -1193,7 +1193,7 @@ bool GlueCompiler::PopulateEvents() {
acc.expression = e; acc.expression = e;
acc.location = ev.location; acc.location = ev.location;
// acc.dollar_id = util::startsWith(e, "$"); // acc.dollar_id = util::startsWith(e, "$");
ev.expression_accessors.push_back(acc); ev.expression_accessors.push_back(std::move(acc));
} }
} }