logging: Switch index-assignment of raw pointers to emplace_back()

This commit is contained in:
Arne Welzel 2024-08-30 10:04:26 +02:00
parent 245fd0c94f
commit a9290cc031
2 changed files with 10 additions and 6 deletions

View file

@ -1158,9 +1158,10 @@ bool Manager::WriteToFilters(const Manager::Stream* stream, zeek::RecordValPtr c
if ( zeek::plugin_mgr->HavePluginForHook(zeek::plugin::HOOK_LOG_WRITE) ) {
// The current HookLogWrite API takes a threading::Value**.
// Fabricate the pointer array on the fly. Mutation is allowed.
std::vector<threading::Value*> vals(rec.size());
for ( size_t i = 0; i < rec.size(); i++ )
vals[i] = &rec[i];
std::vector<threading::Value*> vals;
vals.reserve(rec.size());
for ( auto& v : rec )
vals.emplace_back(&v);
bool res =
zeek::plugin_mgr->HookLogWrite(filter->writer->GetType()->AsEnumType()->Lookup(