Fixing a problem with records having optional fields when used as

table/set indices.

This addresses #367. In principle, the fix is quite straightford.
However, it turns out that sometimes record fields lost their
attributes on assignment, and then the hashing can't decide anymore
whether a field is optional or not. So that needed to be fixed as
well.
This commit is contained in:
Robin Sommer 2011-02-02 18:06:02 -08:00
parent e00acaddd8
commit 7abd8f177f
7 changed files with 171 additions and 33 deletions

View file

@ -1430,6 +1430,17 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
return 0;
}
int same_attrs(const Attributes* a1, const Attributes* a2)
{
if ( ! a1 )
return (a2 != 0);
if ( ! a2 )
return 0;
return (*a1 == *a2);
}
int record_promotion_compatible(const RecordType* /* super_rec */,
const RecordType* /* sub_rec */)
{