mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix a swath of AUTO_CAUSES_COPY issues reported by Coverity
This commit is contained in:
parent
f631551ffb
commit
2abc82722f
7 changed files with 9 additions and 9 deletions
|
@ -883,7 +883,7 @@ bool SwitchStmt::AddCaseLabelValueMapping(const Val* v, int idx)
|
||||||
|
|
||||||
bool SwitchStmt::AddCaseLabelTypeMapping(ID* t, int idx)
|
bool SwitchStmt::AddCaseLabelTypeMapping(ID* t, int idx)
|
||||||
{
|
{
|
||||||
for ( auto i : case_label_type_list )
|
for ( const auto& i : case_label_type_list )
|
||||||
{
|
{
|
||||||
if ( same_type(i.first->GetType(), t->GetType()) )
|
if ( same_type(i.first->GetType(), t->GetType()) )
|
||||||
return false;
|
return false;
|
||||||
|
@ -918,7 +918,7 @@ std::pair<int, ID*> SwitchStmt::FindCaseLabelMatch(const Val* v) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find matching type cases.
|
// Find matching type cases.
|
||||||
for ( auto i : case_label_type_list )
|
for ( const auto& i : case_label_type_list )
|
||||||
{
|
{
|
||||||
auto id = i.first;
|
auto id = i.first;
|
||||||
const auto& type = id->GetType();
|
const auto& type = id->GetType();
|
||||||
|
|
|
@ -161,7 +161,7 @@ zeek::StringValPtr asn1_oid_to_val(const ASN1Encoding* oid)
|
||||||
// Underflow.
|
// Underflow.
|
||||||
return zeek::val_mgr->EmptyString();
|
return zeek::val_mgr->EmptyString();
|
||||||
|
|
||||||
for ( auto subidentifier : subidentifiers )
|
for ( const auto& subidentifier : subidentifiers )
|
||||||
{
|
{
|
||||||
uint64 value = 0;
|
uint64 value = 0;
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool WriterBackend::WriterInfo::FromBroker(broker::data d)
|
||||||
rotation_interval = *brotation_interval;
|
rotation_interval = *brotation_interval;
|
||||||
network_time = *bnetwork_time;
|
network_time = *bnetwork_time;
|
||||||
|
|
||||||
for ( auto i : *bconfig )
|
for ( const auto& i : *bconfig )
|
||||||
{
|
{
|
||||||
auto k = broker::get_if<std::string>(&i.first);
|
auto k = broker::get_if<std::string>(&i.first);
|
||||||
auto v = broker::get_if<std::string>(&i.second);
|
auto v = broker::get_if<std::string>(&i.second);
|
||||||
|
|
|
@ -314,7 +314,7 @@ void CPPCompile::GenEpilog()
|
||||||
GenCPPDynStmt();
|
GenCPPDynStmt();
|
||||||
|
|
||||||
NL();
|
NL();
|
||||||
for ( auto gi : all_global_info )
|
for ( const auto& gi : all_global_info )
|
||||||
gi->GenerateInitializers(this);
|
gi->GenerateInitializers(this);
|
||||||
|
|
||||||
NL();
|
NL();
|
||||||
|
@ -449,7 +449,7 @@ void CPPCompile::GenFinishInit()
|
||||||
max_cohort = std::max(max_cohort, gi->MaxCohort());
|
max_cohort = std::max(max_cohort, gi->MaxCohort());
|
||||||
|
|
||||||
for ( auto c = 0; c <= max_cohort; ++c )
|
for ( auto c = 0; c <= max_cohort; ++c )
|
||||||
for ( auto gi : all_global_info )
|
for ( const auto& gi : all_global_info )
|
||||||
if ( gi->CohortSize(c) > 0 )
|
if ( gi->CohortSize(c) > 0 )
|
||||||
Emit("%s.InitializeCohort(&im, %s);", gi->InitializersName(), Fmt(c));
|
Emit("%s.InitializeCohort(&im, %s);", gi->InitializersName(), Fmt(c));
|
||||||
|
|
||||||
|
|
|
@ -895,7 +895,7 @@ StmtPtr InitStmt::Duplicate()
|
||||||
// Need to duplicate the initializer list since later reductions
|
// Need to duplicate the initializer list since later reductions
|
||||||
// can modify it in place.
|
// can modify it in place.
|
||||||
std::vector<IDPtr> new_inits;
|
std::vector<IDPtr> new_inits;
|
||||||
for ( auto id : inits )
|
for ( const auto& id : inits )
|
||||||
new_inits.push_back(id);
|
new_inits.push_back(id);
|
||||||
|
|
||||||
return SetSucc(new InitStmt(new_inits));
|
return SetSucc(new InitStmt(new_inits));
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool UseDefs::RemoveUnused(int iter)
|
||||||
const auto& inits = init->Inits();
|
const auto& inits = init->Inits();
|
||||||
std::vector<IDPtr> used_ids;
|
std::vector<IDPtr> used_ids;
|
||||||
|
|
||||||
for ( auto id : inits )
|
for ( const auto& id : inits )
|
||||||
if ( is_atomic_type(id->GetType()) || ! CheckIfUnused(s, id.get(), false) )
|
if ( is_atomic_type(id->GetType()) || ! CheckIfUnused(s, id.get(), false) )
|
||||||
used_ids.emplace_back(id);
|
used_ids.emplace_back(id);
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ void ZAMCompiler::Dump()
|
||||||
if ( remapped_frame )
|
if ( remapped_frame )
|
||||||
printf("Original frame for %s:\n", func->Name());
|
printf("Original frame for %s:\n", func->Name());
|
||||||
|
|
||||||
for ( auto elem : frame_layout1 )
|
for ( const auto& elem : frame_layout1 )
|
||||||
printf("frame[%d] = %s\n", elem.second, elem.first->Name());
|
printf("frame[%d] = %s\n", elem.second, elem.first->Name());
|
||||||
|
|
||||||
if ( remapped_frame )
|
if ( remapped_frame )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue