mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/zval'
* origin/topic/vern/zval: (42 commits) whitespace tweaks resolved some TODO comments remove unnecessary casts, and change necessary ones to use static_cast<> explain cmp_func default change functions for ZVal type management to static members fix some unsigned/signed integer warnings address lint concern about uninitialized variable Remove use of obsolete forward-declaration macros fix #include's that lack zeek/ prefixes explicitly populate holes created in vectors fixes for now-incorrect assumption that GetField always returns an existing ValPtr memory management for assignment to vector elements memory management for assignment to record fields destructor cleanup from ZAM_vector/ZAM_record fix #include's that lack zeek/ prefixes overlooked another way in which vector holes can be created initialize vector holes to the correct corresponding type explicitly populate holes created in vectors fix other instances of GetField().get() assuming long-lived ValPtr's fix for now-incorrect assumption that GetField always returns an existing ValPtr ...
This commit is contained in:
commit
f45df63cd0
100 changed files with 2376 additions and 1386 deletions
24
src/Type.cc
24
src/Type.cc
|
@ -840,7 +840,16 @@ void TypeDecl::DescribeReST(ODesc* d, bool roles_only) const
|
|||
RecordType::RecordType(type_decl_list* arg_types) : Type(TYPE_RECORD)
|
||||
{
|
||||
types = arg_types;
|
||||
num_fields = types ? types->length() : 0;
|
||||
|
||||
if ( types )
|
||||
{
|
||||
num_fields = types->length();
|
||||
|
||||
loop_over_list(*types, i)
|
||||
AddField(i, (*types)[i]);
|
||||
}
|
||||
else
|
||||
num_fields = 0;
|
||||
}
|
||||
|
||||
// in this case the clone is actually not so shallow, since
|
||||
|
@ -864,6 +873,13 @@ RecordType::~RecordType()
|
|||
}
|
||||
}
|
||||
|
||||
void RecordType::AddField(unsigned int field, const TypeDecl* td)
|
||||
{
|
||||
ASSERT(field == managed_fields.size());
|
||||
|
||||
managed_fields.push_back(ZVal::IsManagedType(td->type));
|
||||
}
|
||||
|
||||
bool RecordType::HasField(const char* field) const
|
||||
{
|
||||
return FieldOffset(field) >= 0;
|
||||
|
@ -1001,8 +1017,8 @@ TableValPtr RecordType::GetRecordFieldsVal(const RecordVal* rv) const
|
|||
auto nr = make_intrusive<RecordVal>(record_field);
|
||||
|
||||
string s = container_type_name(ft.get());
|
||||
nr->Assign(0, make_intrusive<StringVal>(s));
|
||||
nr->Assign(1, val_mgr->Bool(logged));
|
||||
nr->Assign(0, s);
|
||||
nr->Assign(1, logged);
|
||||
nr->Assign(2, std::move(fv));
|
||||
nr->Assign(3, FieldDefault(i));
|
||||
auto field_name = make_intrusive<StringVal>(FieldName(i));
|
||||
|
@ -1037,7 +1053,9 @@ const char* RecordType::AddFields(const type_decl_list& others,
|
|||
td->attrs->AddAttr(make_intrusive<detail::Attr>(detail::ATTR_LOG));
|
||||
}
|
||||
|
||||
int field = types->size();
|
||||
types->push_back(td);
|
||||
AddField(field, td);
|
||||
}
|
||||
|
||||
num_fields = types->length();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue