mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +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
|
@ -365,7 +365,7 @@ bool Serializer::UnserializeCall(UnserialInfo* info)
|
|||
d.SetIncludeStats(true);
|
||||
d.SetShort();
|
||||
|
||||
val_list* args = new val_list;
|
||||
val_list* args = new val_list(len);
|
||||
for ( int i = 0; i < len; ++i )
|
||||
{
|
||||
Val* v = Val::Unserialize(info);
|
||||
|
@ -996,7 +996,8 @@ void EventPlayer::GotEvent(const char* name, double time,
|
|||
{
|
||||
ne_time = time;
|
||||
ne_handler = event;
|
||||
ne_args = args;
|
||||
ne_args = std::move(*args);
|
||||
delete args;
|
||||
}
|
||||
|
||||
void EventPlayer::GotFunctionCall(const char* name, double time,
|
||||
|
@ -1054,7 +1055,7 @@ void EventPlayer::Process()
|
|||
if ( ! (io && ne_time) )
|
||||
return;
|
||||
|
||||
Event* event = new Event(ne_handler, ne_args);
|
||||
Event* event = new Event(ne_handler, std::move(ne_args));
|
||||
mgr.Dispatch(event);
|
||||
|
||||
ne_time = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue