Val: use C++ initializers

This commit is contained in:
Max Kellermann 2020-02-07 11:21:15 +01:00
parent 4a5473c572
commit 59b5e6b7dc
2 changed files with 14 additions and 41 deletions

View file

@ -38,28 +38,23 @@
#include "threading/formatters/JSON.h"
Val::Val(Func* f)
:val(f)
:val(f), type(f->FType()->Ref())
{
::Ref(val.func_val);
type = f->FType()->Ref();
#ifdef DEBUG
bound_id = 0;
#endif
}
Val::Val(BroFile* f)
:val(f)
static FileType *GetStringFileType() noexcept
{
static FileType* string_file_type = 0;
if ( ! string_file_type )
string_file_type = new FileType(base_type(TYPE_STRING));
return string_file_type;
}
Val::Val(BroFile* f)
:val(f), type(GetStringFileType()->Ref())
{
assert(f->FType()->Tag() == TYPE_STRING);
type = string_file_type->Ref();
#ifdef DEBUG
bound_id = 0;
#endif
}
Val::~Val()