mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Pre-allocate and re-use Vals for bool, int, count, enum and empty string
This commit is contained in:
parent
dcbef9cbe3
commit
2982765128
136 changed files with 1859 additions and 1811 deletions
|
@ -685,9 +685,11 @@ 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
|
||||
pval = new Val(*kp, tag);
|
||||
pval = val_mgr->GetInt(*kp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -699,11 +701,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