mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/val_mgr'
* origin/topic/jsiwek/val_mgr: Pre-allocate and re-use Vals for bool, int, count, enum and empty string Preallocate booleans and small counts I added a tiny change to CompHash to make sure that nothing messes this up in the future.
This commit is contained in:
commit
d4f7dae768
136 changed files with 1924 additions and 1776 deletions
|
@ -685,9 +685,16 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
kp1 = reinterpret_cast<const char*>(kp+1);
|
||||
|
||||
if ( tag == TYPE_ENUM )
|
||||
pval = new EnumVal(*kp, t->AsEnumType());
|
||||
pval = t->AsEnumType()->GetVal(*kp);
|
||||
else if ( tag == TYPE_BOOL )
|
||||
pval = val_mgr->GetBool(*kp);
|
||||
else if ( tag == TYPE_INT )
|
||||
pval = val_mgr->GetInt(*kp);
|
||||
else
|
||||
pval = new Val(*kp, tag);
|
||||
{
|
||||
reporter->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()");
|
||||
pval = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -699,11 +706,11 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
switch ( tag ) {
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
pval = new Val(*kp, tag);
|
||||
pval = val_mgr->GetCount(*kp);
|
||||
break;
|
||||
|
||||
case TYPE_PORT:
|
||||
pval = port_mgr->Get(*kp);
|
||||
pval = val_mgr->GetPort(*kp);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue