In once case we actually want a copy so annotate it.
Coverity 380098, 380102, 380103, 380106, 380107, 280109, 380111, 380112, 380113, 380117
{
auto certs = d_certs.write_lock();
- for (auto pair : *certs) {
+ for (const auto& pair : *certs) {
if (pair->cert.getSerial() == newCert->cert.getSerial()) {
if (reload) {
/* on reload we just assume that this is the same certificate */
void DNSCryptContext::markActive(uint32_t serial)
{
- for (auto pair : *d_certs.write_lock()) {
+ for (const auto& pair : *d_certs.write_lock()) {
if (pair->active == false && pair->cert.getSerial() == serial) {
pair->active = true;
return;
void DNSCryptContext::markInactive(uint32_t serial)
{
- for (auto pair : *d_certs.write_lock()) {
+ for (const auto& pair : *d_certs.write_lock()) {
if (pair->active == true && pair->cert.getSerial() == serial) {
pair->active = false;
return;
unsigned int lab = *labels;
for (const auto& shard : g_rings.d_shards) {
auto rl = shard->queryRing.lock();
- for(auto a : *rl) {
+ // coverity[auto_causes_copy]
+ for (auto a : *rl) {
a.name.trimToLabels(lab);
counts[a.name]++;
total++;
auto aclList = doc["value"];
if (aclList.is_array()) {
- for (auto value : aclList.array_items()) {
+ for (const auto& value : aclList.array_items()) {
try {
nmg.addMask(value.string_value());
} catch (NetmaskException &e) {
}
const time_t now = time(nullptr);
- for (auto pair : caches) {
+ for (const auto& pair : caches) {
/* shall we keep expired entries ? */
if (pair.second == true) {
continue;
if (ctx != nullptr) {
size_t idx = 1;
- for (auto pair : ctx->getCertificates()) {
+ for (const auto& pair : ctx->getCertificates()) {
result.push_back({idx++, pair});
}
}
boost::format fmt("%1$-3d %|5t|%2$-8d %|10t|%3$-7d %|20t|%4$-21.21s %|41t|%5$-21.21s");
ret << (fmt % "#" % "Serial" % "Version" % "From" % "To" ) << endl;
- for (auto pair : ctx->getCertificates()) {
+ for (const auto& pair : ctx->getCertificates()) {
const auto cert = pair->cert;
const DNSCryptExchangeVersion version = DNSCryptContext::getExchangeVersion(cert);
}
}
if (vars->count("skipOptions")) {
- for (auto option: boost::get<LuaArray<uint16_t>>(vars->at("skipOptions"))) {
+ for (const auto& option: boost::get<LuaArray<uint16_t>>(vars->at("skipOptions"))) {
optionsToSkip.insert(option.second);
}
}