Prettyfing Describe() for record types.

If a record type has a name and ODesc is set to short, we now print
the name instead of the full field list.
This commit is contained in:
Robin Sommer 2013-09-28 16:06:40 -07:00
parent dc52846b6f
commit 08c7dd3d71
2 changed files with 11 additions and 5 deletions

View file

@ -1037,12 +1037,18 @@ TypeDecl* RecordType::FieldDecl(int field)
void RecordType::Describe(ODesc* d) const
{
if ( d->IsReadable() )
{
if ( d->IsShort() && GetTypeID() )
d->Add(GetTypeID());
else
{
d->AddSP("record {");
DescribeFields(d);
d->SP();
d->Add("}");
}
}
else
{

View file

@ -314,9 +314,9 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
delete [] data;
}
tnew->SetTypeID(copy_string(id->Name()));
}
tnew->SetTypeID(copy_string(id->Name()));
id->SetType(tnew);
id->MakeType();