mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
use iterator-based idiom for check-if-present-then-access
This commit is contained in:
parent
735d584d9f
commit
84423369b4
12 changed files with 86 additions and 59 deletions
|
@ -258,8 +258,9 @@ void CPPCompile::RegisterCompiledBody(const string& f)
|
|||
|
||||
// Build up an initializer of the events relevant to the function.
|
||||
string events;
|
||||
if ( body_events.count(f) > 0 )
|
||||
for ( const auto& e : body_events[f] )
|
||||
auto be = body_events.find(f);
|
||||
if ( be != body_events.end() )
|
||||
for ( const auto& e : be->second )
|
||||
{
|
||||
if ( events.size() > 0 )
|
||||
events += ", ";
|
||||
|
@ -278,8 +279,9 @@ void CPPCompile::RegisterCompiledBody(const string& f)
|
|||
// same binary).
|
||||
h = merge_p_hashes(h, p_hash(cf_locs[f]));
|
||||
|
||||
ASSERT(func_index.count(f) > 0);
|
||||
auto type_signature = casting_index[func_index[f]];
|
||||
auto fi = func_index.find(f);
|
||||
ASSERT(fi != func_index.end());
|
||||
auto type_signature = casting_index[fi->second];
|
||||
Emit("\tCPP_RegisterBody(\"%s\", (void*) %s, %s, %s, %s, std::vector<std::string>(%s)),", f, f,
|
||||
Fmt(type_signature), Fmt(p), Fmt(h), events);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue