From: Otto Moerbeek Date: Wed, 29 May 2024 08:07:18 +0000 (+0200) Subject: rec: fix cases of copy instead of move, as reported by coverity X-Git-Tag: rec-5.1.0-beta1~15^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14259%2Fhead;p=thirdparty%2Fpdns.git rec: fix cases of copy instead of move, as reported by coverity --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 5784e63db3..044aeca9cb 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -3193,7 +3193,7 @@ int main(int argc, char** argv) } if (yamlstatus == pdns::settings::rec::YamlSettingsStatus::OK) { auto lock = g_yamlStruct.lock(); - *lock = settings; + *lock = std::move(settings); } if (yamlstatus == pdns::settings::rec::YamlSettingsStatus::CannotOpen) { configname += ".conf"; diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index d86c097640..6637bd93ee 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -2218,7 +2218,7 @@ RecursorControlChannel::Answer luaconfig(bool broadcast) lci = g_luaconfs.getCopy(); if (broadcast) { startLuaConfigDelayedThreads(lci.rpzs, lci.generation); - broadcastFunction([=] { return pleaseSupplantProxyMapping(proxyMapping); }); + broadcastFunction([pmap = std::move(proxyMapping)] { return pleaseSupplantProxyMapping(pmap); }); } else { // Initial proxy mapping diff --git a/pdns/recursordist/settings/cxxsupport.cc b/pdns/recursordist/settings/cxxsupport.cc index 0edb5472d1..dd88d1f060 100644 --- a/pdns/recursordist/settings/cxxsupport.cc +++ b/pdns/recursordist/settings/cxxsupport.cc @@ -638,7 +638,7 @@ std::string pdns::settings::rec::defaultsToYaml() // And for all other values below, the default is either an empty string or an empty vector. // Once we get more u64 values below with different default values this hack no longer works. rustvalue.u64_val = 24; - map.emplace(std::pair{std::pair{section, name}, pdns::rust::settings::rec::OldStyle{section, name, name, type, rustvalue, false}}); + map.emplace(std::pair{std::pair{section, name}, pdns::rust::settings::rec::OldStyle{section, name, name, type, std::move(rustvalue), false}}); }; def("dnssec", "trustanchors", "Vec"); def("dnssec", "negative_trustanchors", "Vec");