Skip to content

Commit

Permalink
Buch of Coverity "Variable copied when it could be moved" cases
Browse files Browse the repository at this point in the history
  • Loading branch information
omoerbeek committed Feb 14, 2025
1 parent 7031f59 commit 9132094
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pdns/arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void ArgvMap::gatherIncludes(const std::string& directory, const std::string& su
string msg = fullName + " is not a regular file";
SLOG(g_log << Logger::Error << msg << std::endl,
d_log->info(Logr::Error, "Unable to open non-regular file", "name", Logging::Loggable(fullName)));
throw ArgException(msg);
throw ArgException(std::move(msg));
}
vec.emplace_back(fullName);
}
Expand All @@ -600,7 +600,7 @@ void ArgvMap::gatherIncludes(const std::string& directory, const std::string& su
string msg = directory + " is not accessible: " + stringerror(err);
SLOG(g_log << Logger::Error << msg << std::endl,
d_log->error(Logr::Error, err, "Directory is not accessible", "name", Logging::Loggable(directory)));
throw ArgException(msg);
throw ArgException(std::move(msg));
}

std::sort(vec.begin(), vec.end(), CIStringComparePOSIX());
Expand Down
4 changes: 2 additions & 2 deletions pdns/lua-base4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void BaseLua4::includePath(const std::string& directory) {
if (stat(fullName.c_str(), &statInfo) != 0 || !S_ISREG(statInfo.st_mode)) {
string msg = fullName + " is not a regular file";
g_log << Logger::Error << msg << std::endl;
throw PDNSException(msg);
throw PDNSException(std::move(msg));
}
vec.emplace_back(fullName);
}
Expand All @@ -63,7 +63,7 @@ void BaseLua4::includePath(const std::string& directory) {
int err = errno;
string msg = directory + " is not accessible: " + stringerror(err);
g_log << Logger::Error << msg << std::endl;
throw PDNSException(msg);
throw PDNSException(std::move(msg));
}

std::sort(vec.begin(), vec.end(), CIStringComparePOSIX());
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ int SyncRes::AuthDomain::getRecords(const DNSName& qname, const QType qtype, std
// we hit a delegation point!
DNSRecord dnsRecord = *ziter;
dnsRecord.d_place = DNSResourceRecord::AUTHORITY;
records.push_back(dnsRecord);
records.push_back(std::move(dnsRecord));
}
}

Expand Down
4 changes: 2 additions & 2 deletions pdns/zonemd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ void pdns::ZoneMD::readRecords(ZoneParserTNG& zpt)
}
catch (const PDNSException& pe) {
std::string err = "Bad record content in record for '" + dnsResourceRecord.qname.toStringNoDot() + "'|" + dnsResourceRecord.qtype.toString() + ": " + pe.reason;
throw PDNSException(err);
throw PDNSException(std::move(err));
}
catch (const std::exception& e) {
std::string err = "Bad record content in record for '" + dnsResourceRecord.qname.toStringNoDot() + "|" + dnsResourceRecord.qtype.toString() + "': " + e.what();
throw PDNSException(err);
throw PDNSException(std::move(err));
}
DNSRecord rec;
rec.d_name = dnsResourceRecord.qname;
Expand Down

0 comments on commit 9132094

Please sign in to comment.