mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Bro doc mode now only does a "shallow" copy of declared record types
This is necessary so that the cloned type will be able to see additions to the original type's list of fields
This commit is contained in:
parent
d919ebed58
commit
6d867cf999
3 changed files with 55 additions and 13 deletions
35
src/Var.cc
35
src/Var.cc
|
@ -242,22 +242,31 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
|
|||
// t->GetTypeID() is true.
|
||||
if ( generate_documentation )
|
||||
{
|
||||
SerializationFormat* form = new BinarySerializationFormat();
|
||||
form->StartWrite();
|
||||
CloneSerializer ss(form);
|
||||
SerialInfo sinfo(&ss);
|
||||
sinfo.cache = false;
|
||||
if ( t->Tag() == TYPE_RECORD )
|
||||
{
|
||||
// Only "shallow" copy record types because we want to be able
|
||||
// to see additions to the original type's list of fields
|
||||
tnew = new RecordType(t->AsRecordType()->Types());
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializationFormat* form = new BinarySerializationFormat();
|
||||
form->StartWrite();
|
||||
CloneSerializer ss(form);
|
||||
SerialInfo sinfo(&ss);
|
||||
sinfo.cache = false;
|
||||
|
||||
t->Serialize(&sinfo);
|
||||
char* data;
|
||||
uint32 len = form->EndWrite(&data);
|
||||
form->StartRead(data, len);
|
||||
t->Serialize(&sinfo);
|
||||
char* data;
|
||||
uint32 len = form->EndWrite(&data);
|
||||
form->StartRead(data, len);
|
||||
|
||||
UnserialInfo uinfo(&ss);
|
||||
uinfo.cache = false;
|
||||
tnew = t->Unserialize(&uinfo);
|
||||
UnserialInfo uinfo(&ss);
|
||||
uinfo.cache = false;
|
||||
tnew = t->Unserialize(&uinfo);
|
||||
|
||||
delete [] data;
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
tnew->SetTypeID(copy_string(id->Name()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue