mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Merge remote-tracking branch 'origin/master' into topic/seth/notice-suppression
This commit is contained in:
commit
d18fdef2d4
548 changed files with 523 additions and 29934 deletions
11
src/Val.cc
11
src/Val.cc
|
@ -1,5 +1,3 @@
|
|||
// $Id: Val.cc 6945 2009-11-27 19:25:10Z vern $
|
||||
//
|
||||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include "config.h"
|
||||
|
@ -2865,7 +2863,7 @@ Val* RecordVal::LookupWithDefault(int field) const
|
|||
return record_type->FieldDefault(field);
|
||||
}
|
||||
|
||||
RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr) const
|
||||
RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr, bool allow_orphaning) const
|
||||
{
|
||||
if ( ! record_promotion_compatible(t->AsRecordType(), Type()->AsRecordType()) )
|
||||
return 0;
|
||||
|
@ -2885,6 +2883,9 @@ RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr) const
|
|||
|
||||
if ( t_i < 0 )
|
||||
{
|
||||
if ( allow_orphaning )
|
||||
continue;
|
||||
|
||||
char buf[512];
|
||||
safe_snprintf(buf, sizeof(buf),
|
||||
"orphan field \"%s\" in initialization",
|
||||
|
@ -2918,7 +2919,7 @@ RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr) const
|
|||
return ar;
|
||||
}
|
||||
|
||||
RecordVal* RecordVal::CoerceTo(RecordType* t)
|
||||
RecordVal* RecordVal::CoerceTo(RecordType* t, bool allow_orphaning)
|
||||
{
|
||||
if ( same_type(Type(), t) )
|
||||
{
|
||||
|
@ -2926,7 +2927,7 @@ RecordVal* RecordVal::CoerceTo(RecordType* t)
|
|||
return this;
|
||||
}
|
||||
|
||||
return CoerceTo(t, 0);
|
||||
return CoerceTo(t, 0, allow_orphaning);
|
||||
}
|
||||
|
||||
void RecordVal::Describe(ODesc* d) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue