diff --git a/src/Debug.cc b/src/Debug.cc index ee0057f8f9..088913a941 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -340,7 +340,7 @@ vector parse_location_string(const string& s) { return result; } - loc_filename = path; + loc_filename = std::move(path); plr.type = PLR_FILE_AND_LINE; } } diff --git a/src/EventTrace.cc b/src/EventTrace.cc index 33301e9fb8..3298447e89 100644 --- a/src/EventTrace.cc +++ b/src/EventTrace.cc @@ -708,7 +708,7 @@ void EventTrace::Generate(FILE* f, ValTraceMgr& vtm, const EventTrace* predecess } } - Generate(f, vtm, deltas, successor); + Generate(f, vtm, deltas, std::move(successor)); } void ValTraceMgr::TraceEventValues(std::shared_ptr et, const zeek::Args* args) { @@ -726,7 +726,7 @@ void ValTraceMgr::TraceEventValues(std::shared_ptr et, const zeek::A ev_args += ValName(a); } - curr_ev->SetArgs(ev_args); + curr_ev->SetArgs(std::move(ev_args)); // Now look for any values newly-processed with this event and // remember them so we can catch uses of them in future events. @@ -780,7 +780,7 @@ void ValTraceMgr::AddVal(ValPtr v) { else { auto vt = std::make_shared(v); AssessChange(vt.get(), mapping->second.get()); - val_map[v.get()] = vt; + val_map[v.get()] = std::move(vt); } } @@ -790,7 +790,7 @@ void ValTraceMgr::NewVal(ValPtr v) { auto vt = std::make_shared(v); AssessChange(vt.get(), nullptr); - val_map[v.get()] = vt; + val_map[v.get()] = std::move(vt); } void ValTraceMgr::ValUsed(const ValPtr& v) { @@ -834,7 +834,7 @@ void ValTraceMgr::AssessChange(const ValTrace* vt, const ValTrace* prev_vt) { previous_deltas.insert(std::move(full_delta)); ValUsed(vp); - curr_ev->AddDelta(vp, rhs, needs_lhs, is_first_def); + curr_ev->AddDelta(vp, std::move(rhs), needs_lhs, is_first_def); } auto& v = vt->GetVal(); @@ -1025,7 +1025,7 @@ void EventTraceMgr::StartEvent(const ScriptFunc* ev, const zeek::Args* args) { auto et = std::make_shared(ev, nt, events.size()); events.emplace_back(et); - vtm.TraceEventValues(et, args); + vtm.TraceEventValues(std::move(et), args); } void EventTraceMgr::EndEvent(const ScriptFunc* ev, const zeek::Args* args) { diff --git a/src/Expr.cc b/src/Expr.cc index 3bcf9d96a5..96c6a0d46d 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -4245,7 +4245,7 @@ LambdaExpr::LambdaExpr(FunctionIngredientsPtr arg_ing, IDPList arg_outer_ids, st if ( name.empty() ) BuildName(); else - my_name = name; + my_name = std::move(name); // Install that in the current scope. lambda_id = install_ID(my_name.c_str(), current_module.c_str(), true, false); diff --git a/src/Options.cc b/src/Options.cc index 59322131f7..5f4494977c 100644 --- a/src/Options.cc +++ b/src/Options.cc @@ -616,7 +616,7 @@ Options parse_cmdline(int argc, char** argv) { exit(1); } - *path = res; + *path = std::move(res); if ( (*path)[0] == '/' || (*path)[0] == '~' ) // Now an absolute path diff --git a/src/ScriptCoverageManager.cc b/src/ScriptCoverageManager.cc index 4042996aaf..2a0747bd45 100644 --- a/src/ScriptCoverageManager.cc +++ b/src/ScriptCoverageManager.cc @@ -136,7 +136,7 @@ bool ScriptCoverageManager::WriteStats() { auto ft = func->GetType(); auto desc = ft->FlavorString() + " " + func->Name() + " BODY"; - TrackUsage(body, desc, body->GetAccessCount()); + TrackUsage(body, std::move(desc), body->GetAccessCount()); } for ( const auto& [cond_loc, text, was_true] : cond_instances ) diff --git a/src/analyzer/protocol/conn-size/Plugin.cc b/src/analyzer/protocol/conn-size/Plugin.cc index 51ce78b527..ef14ac2532 100644 --- a/src/analyzer/protocol/conn-size/Plugin.cc +++ b/src/analyzer/protocol/conn-size/Plugin.cc @@ -33,7 +33,7 @@ public: thresholds.emplace_back(lv->Idx(i)->AsCount()); std::sort(thresholds.begin(), thresholds.end()); - zeek::analyzer::conn_size::ConnSize_Analyzer::SetGenericPacketThresholds(thresholds); + zeek::analyzer::conn_size::ConnSize_Analyzer::SetGenericPacketThresholds(std::move(thresholds)); } } plugin; diff --git a/src/cluster/Backend.cc b/src/cluster/Backend.cc index ffa4872e60..3c51259e42 100644 --- a/src/cluster/Backend.cc +++ b/src/cluster/Backend.cc @@ -310,7 +310,7 @@ TEST_SUITE_BEGIN("cluster event"); TEST_CASE("add metadata") { auto* handler = zeek::event_registry->Lookup("Supervisor::node_status"); zeek::Args args{zeek::make_intrusive("TEST"), zeek::val_mgr->Count(42)}; - zeek::cluster::detail::Event event{handler, args, nullptr}; + zeek::cluster::detail::Event event{handler, std::move(args), nullptr}; auto nts = zeek::id::find_val("EventMetadata::NETWORK_TIMESTAMP"); REQUIRE(nts); diff --git a/src/input/Manager.cc b/src/input/Manager.cc index ad07695977..bfae85650d 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -1431,7 +1431,7 @@ int Manager::SendEventStreamEvent(Stream* i, EnumVal* type, const Value* const* Unref(val); } else - SendEvent(stream->event, out_vals); + SendEvent(stream->event, std::move(out_vals)); return stream->num_fields; } diff --git a/src/input/readers/ascii/Ascii.cc b/src/input/readers/ascii/Ascii.cc index 81fca8ef63..df9f155cbb 100644 --- a/src/input/readers/ascii/Ascii.cc +++ b/src/input/readers/ascii/Ascii.cc @@ -175,7 +175,7 @@ bool Ascii::ReadHeader(bool useCached) { line = headerline; // construct list of field names. - auto ifields = util::split(line, separator[0]); + auto ifields = util::split(std::move(line), separator[0]); // printf("Updating fields from description %s\n", line.c_str()); columnMap.clear(); diff --git a/src/packet_analysis/Manager.cc b/src/packet_analysis/Manager.cc index 956d9b42d1..99d751ce5b 100644 --- a/src/packet_analysis/Manager.cc +++ b/src/packet_analysis/Manager.cc @@ -216,7 +216,8 @@ bool Manager::PermitUnknownProtocol(const std::string& analyzer, uint32_t protoc ++count; if ( count == 1 ) - zeek::detail::timer_mgr->Add(new UnknownProtocolTimer(run_state::network_time, p, unknown_sampling_duration)); + zeek::detail::timer_mgr->Add( + new UnknownProtocolTimer(run_state::network_time, std::move(p), unknown_sampling_duration)); if ( count < unknown_sampling_threshold ) return true; diff --git a/src/packet_analysis/packet_analysis.bif b/src/packet_analysis/packet_analysis.bif index 77766d1185..33346a8364 100644 --- a/src/packet_analysis/packet_analysis.bif +++ b/src/packet_analysis/packet_analysis.bif @@ -24,7 +24,7 @@ function register_packet_analyzer%(parent: PacketAnalyzer::Tag, identifier: coun if ( ! child_analyzer ) return zeek::val_mgr->False(); - parent_analyzer->RegisterProtocol(identifier, child_analyzer); + parent_analyzer->RegisterProtocol(identifier, std::move(child_analyzer)); return zeek::val_mgr->True(); %} @@ -45,7 +45,7 @@ function try_register_packet_analyzer_by_name%(parent: string, identifier: count if ( ! child_analyzer ) return zeek::val_mgr->False(); - parent_analyzer->RegisterProtocol(identifier, child_analyzer); + parent_analyzer->RegisterProtocol(identifier, std::move(child_analyzer)); return zeek::val_mgr->True(); %} @@ -74,7 +74,7 @@ function register_protocol_detection%(parent: PacketAnalyzer::Tag, child: Packet if ( ! child_analyzer ) return zeek::val_mgr->False(); - parent_analyzer->RegisterProtocolDetection(child_analyzer); + parent_analyzer->RegisterProtocolDetection(std::move(child_analyzer)); return zeek::val_mgr->True(); %} diff --git a/src/packet_analysis/protocol/ip/IP.cc b/src/packet_analysis/protocol/ip/IP.cc index fd84d388d2..09008ca285 100644 --- a/src/packet_analysis/protocol/ip/IP.cc +++ b/src/packet_analysis/protocol/ip/IP.cc @@ -111,7 +111,7 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet) } // If we got here, the IP_Hdr is most likely valid and safe to use. - packet->ip_hdr = ip_hdr; + packet->ip_hdr = std::move(ip_hdr); // If there's an encapsulation stack in this packet, meaning this packet is part of a chain // of tunnels, make sure to store the IP header in the last flow in the stack so it can be diff --git a/src/script_opt/CPP/Driver.cc b/src/script_opt/CPP/Driver.cc index 6e09098e30..9e273a83a3 100644 --- a/src/script_opt/CPP/Driver.cc +++ b/src/script_opt/CPP/Driver.cc @@ -204,7 +204,7 @@ bool CPPCompile::AnalyzeFuncBody(FuncInfo& fi, unordered_set& filenames_ else if ( filenames_reported_as_skipped.count(fn) == 0 ) { reporter->Warning("skipping compilation of files in %s due to presence of conditional code", fn.c_str()); - filenames_reported_as_skipped.insert(fn); + filenames_reported_as_skipped.emplace(fn); } fi.SetSkip(true); diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index b81344dd38..8e6db2f1c5 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -659,7 +659,7 @@ void analyze_scripts(bool no_unused_warnings) { } auto pfs = std::make_shared(funcs, nullptr, true, true); - analyze_scripts_for_ZAM(pfs); + analyze_scripts_for_ZAM(std::move(pfs)); if ( reporter->Errors() > 0 ) reporter->FatalError("Optimized script execution aborted due to errors"); diff --git a/src/storage/backend/sqlite/SQLite.cc b/src/storage/backend/sqlite/SQLite.cc index 4641f027e8..2d43b971bf 100644 --- a/src/storage/backend/sqlite/SQLite.cc +++ b/src/storage/backend/sqlite/SQLite.cc @@ -46,7 +46,7 @@ OperationResult SQLite::RunPragma(std::string_view name, std::optional split(T s, const T& delim) { */ template std::vector split(T s, U delim) { - return split(s, T{delim}); + return split(std::move(s), std::move(T{delim})); } /** diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index fe9ae50be8..985bd753b0 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -605,7 +605,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) { if ( options.supervisor_mode ) { Supervisor::Config cfg = {}; - cfg.zeek_exe_path = zeek_exe_path; + cfg.zeek_exe_path = std::move(zeek_exe_path); options.filter_supervisor_options(); supervisor_mgr = new Supervisor(std::move(cfg), std::move(*stem)); } diff --git a/src/zeekygen/Target.cc b/src/zeekygen/Target.cc index a9135a4e5b..f0a8e35f92 100644 --- a/src/zeekygen/Target.cc +++ b/src/zeekygen/Target.cc @@ -483,7 +483,7 @@ void ScriptTarget::DoGenerate() const { if ( zeek::detail::zeekygen_mgr->IsUpToDate(target_filename, dep) ) continue; - TargetFile file(target_filename); + TargetFile file(std::move(target_filename)); fprintf(file.f, "%s\n", d->ReStructuredText().c_str()); }