Allow iterating over bif functions with result type vector of any.

This changes the internal type that is used to signal that a vector
is unspecified from any to void.

I tried to verify that the behavior of Bro is still the same. After
a lot of playing around, I think everything still should worl as before.

However, it might be good for someone to take a look at this.

addresses BIT-1144
This commit is contained in:
Bernhard Amann 2014-02-25 15:30:29 -08:00
parent 58eb9bbf28
commit b3bd509b3f
11 changed files with 66 additions and 7 deletions

View file

@ -2976,7 +2976,9 @@ VectorVal::~VectorVal()
bool VectorVal::Assign(unsigned int index, Val* element, Opcode op)
{
if ( element &&
! same_type(element->Type(), vector_type->YieldType(), 0) )
! same_type(element->Type(), vector_type->YieldType(), 0) &&
// if we are unspecified, you can assign anything to us.
! vector_type->IsUnspecifiedVector() )
{
Unref(element);
return false;
@ -3139,7 +3141,7 @@ bool VectorVal::DoUnserialize(UnserialInfo* info)
for ( int i = 0; i < len; ++i )
{
Val* v;
UNSERIALIZE_OPTIONAL(v, Val::Unserialize(info, TYPE_ANY));
UNSERIALIZE_OPTIONAL(v, Val::Unserialize(info, TYPE_ANY)); // accept any type
Assign(i, v);
}