Val: use class IntrusivePtr in class TableVal

This commit is contained in:
Max Kellermann 2020-03-02 19:41:38 +01:00
parent 93c2064b9a
commit 674e141a15
27 changed files with 88 additions and 109 deletions

View file

@ -25,10 +25,8 @@ static Val* empty_connection_table()
{
TypeList* tbl_index = new TypeList(conn_id);
tbl_index->Append(conn_id->Ref());
TableType* tbl_type = new TableType(tbl_index, connection_type->Ref());
Val* rval = new TableVal(tbl_type);
Unref(tbl_type);
return rval;
auto tbl_type = make_intrusive<TableType>(tbl_index, connection_type->Ref());
return new TableVal(std::move(tbl_type));
}
static RecordVal* get_conn_id_val(const Connection* conn)

View file

@ -25,7 +25,7 @@ refine flow File += {
function characteristics_to_bro(c: uint32, len: uint8): TableVal
%{
uint64 mask = (len==16) ? 0xFFFF : 0xFFFFFFFF;
TableVal* char_set = new TableVal(internal_type("count_set")->AsTableType());
TableVal* char_set = new TableVal({NewRef{}, internal_type("count_set")->AsTableType()});
for ( uint16 i=0; i < len; ++i )
{
if ( ((c >> i) & 0x1) == 1 )