void HostTracker::update_cache_interface(uint8_t idx)
{
+ std::lock_guard<std::mutex> lock(host_tracker_lock);
if (idx == cache_idx and cache_interface == host_cache.seg_list[idx])
return;
- std::lock_guard<std::mutex> lock(host_tracker_lock);
cache_idx = idx;
cache_interface = host_cache.seg_list[idx];
{
str += "\nnetwork proto: ";
auto total = network_protos.size();
- while ( total-- )
+ for (auto proto = network_protos.crbegin(); proto != network_protos.crend(); ++proto)
{
- const auto& proto = network_protos[total];
- if ( proto.second == true )
- str += to_string(proto.first) + (total? ", " : "");
+ if ( proto->second == true )
+ str += to_string(proto->first) + (--total ? ", " : "");
}
}
{
str += "\ntransport proto: ";
auto total = xport_protos.size();
- while ( total-- )
+ for (auto proto = xport_protos.crbegin(); proto != xport_protos.crend(); ++proto)
{
- const auto& proto = xport_protos[total];
- if ( proto.second == true )
- str += to_string(proto.first) + (total? ", " : "");
+ if ( proto->second == true )
+ str += to_string(proto->first) + (--total ? ", " : "");
}
}
}
}
- string unique_key = key;
- if ( !s_aliased_name.empty() )
- unique_key = s_aliased_name;
-
+ string unique_key = s_aliased_name.empty() ? key : s_aliased_name;
if ( s_current != unique_key )
{
if ( fqn != orig )
LogMessage("\t%s (%s)\n", key.c_str(), orig);
else
LogMessage("\t%s\n", key.c_str());
- s_current = unique_key;
+ s_current = std::move(unique_key);
}
if ( s_config->dump_config_mode() or s_config->gen_dump_config() )
set_type(fqn);
s = fqn.c_str();
+ // coverity[COPY_INSTEAD_OF_MOVE]
string key = fqn;
set_top(key);