mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Cleanup/improve PList usage and Event API
Majority of PLists are now created as automatic/stack objects, rather than on heap and initialized either with the known-capacity reserved upfront or directly from an initializer_list (so there's no wasted slack in the memory that gets allocated for lists containing a fixed/known number of elements). Added versions of the ConnectionEvent/QueueEvent methods that take a val_list by value. Added a move ctor/assign-operator to Plists to allow passing them around without having to copy the underlying array of pointers.
This commit is contained in:
parent
78dcbcc71a
commit
8bc65f09ec
92 changed files with 1585 additions and 1679 deletions
|
@ -41,12 +41,11 @@ bool DataEvent::DeliverChunk(const u_char* data, uint64 len, uint64 offset)
|
|||
{
|
||||
if ( ! chunk_event ) return true;
|
||||
|
||||
val_list* args = new val_list;
|
||||
args->append(GetFile()->GetVal()->Ref());
|
||||
args->append(new StringVal(new BroString(data, len, 0)));
|
||||
args->append(val_mgr->GetCount(offset));
|
||||
|
||||
mgr.QueueEvent(chunk_event, args);
|
||||
mgr.QueueEvent(chunk_event, {
|
||||
GetFile()->GetVal()->Ref(),
|
||||
new StringVal(new BroString(data, len, 0)),
|
||||
val_mgr->GetCount(offset),
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -55,11 +54,10 @@ bool DataEvent::DeliverStream(const u_char* data, uint64 len)
|
|||
{
|
||||
if ( ! stream_event ) return true;
|
||||
|
||||
val_list* args = new val_list;
|
||||
args->append(GetFile()->GetVal()->Ref());
|
||||
args->append(new StringVal(new BroString(data, len, 0)));
|
||||
|
||||
mgr.QueueEvent(stream_event, args);
|
||||
mgr.QueueEvent(stream_event, {
|
||||
GetFile()->GetVal()->Ref(),
|
||||
new StringVal(new BroString(data, len, 0)),
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue