mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Deprecate TableVal IsSubsetOf and EqualTo taking Val*, use Val&
This commit is contained in:
parent
e01d2c1b37
commit
b85cfc6fe4
3 changed files with 18 additions and 10 deletions
|
@ -767,19 +767,19 @@ IntrusivePtr<Val> BinaryExpr::SetFold(Val* v1, Val* v2) const
|
||||||
}
|
}
|
||||||
|
|
||||||
case EXPR_EQ:
|
case EXPR_EQ:
|
||||||
res = tv1->EqualTo(tv2);
|
res = tv1->EqualTo(*tv2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_NE:
|
case EXPR_NE:
|
||||||
res = ! tv1->EqualTo(tv2);
|
res = ! tv1->EqualTo(*tv2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_LT:
|
case EXPR_LT:
|
||||||
res = tv1->IsSubsetOf(tv2) && tv1->Size() < tv2->Size();
|
res = tv1->IsSubsetOf(*tv2) && tv1->Size() < tv2->Size();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_LE:
|
case EXPR_LE:
|
||||||
res = tv1->IsSubsetOf(tv2);
|
res = tv1->IsSubsetOf(*tv2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPR_GE:
|
case EXPR_GE:
|
||||||
|
|
|
@ -1695,10 +1695,10 @@ IntrusivePtr<TableVal> TableVal::Intersection(const TableVal& tv) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TableVal::EqualTo(const TableVal* tv) const
|
bool TableVal::EqualTo(const TableVal& tv) const
|
||||||
{
|
{
|
||||||
const PDict<TableEntryVal>* t0 = AsTable();
|
const PDict<TableEntryVal>* t0 = AsTable();
|
||||||
const PDict<TableEntryVal>* t1 = tv->AsTable();
|
const PDict<TableEntryVal>* t1 = tv.AsTable();
|
||||||
|
|
||||||
if ( t0->Length() != t1->Length() )
|
if ( t0->Length() != t1->Length() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1722,10 +1722,10 @@ bool TableVal::EqualTo(const TableVal* tv) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TableVal::IsSubsetOf(const TableVal* tv) const
|
bool TableVal::IsSubsetOf(const TableVal& tv) const
|
||||||
{
|
{
|
||||||
const PDict<TableEntryVal>* t0 = AsTable();
|
const PDict<TableEntryVal>* t0 = AsTable();
|
||||||
const PDict<TableEntryVal>* t1 = tv->AsTable();
|
const PDict<TableEntryVal>* t1 = tv.AsTable();
|
||||||
|
|
||||||
if ( t0->Length() > t1->Length() )
|
if ( t0->Length() > t1->Length() )
|
||||||
return false;
|
return false;
|
||||||
|
|
12
src/Val.h
12
src/Val.h
|
@ -813,11 +813,19 @@ public:
|
||||||
// given set. Note that comparisons are done using hash keys,
|
// given set. Note that comparisons are done using hash keys,
|
||||||
// so errors can arise for compound sets such as sets-of-sets.
|
// so errors can arise for compound sets such as sets-of-sets.
|
||||||
// See https://bro-tracker.atlassian.net/browse/BIT-1949.
|
// See https://bro-tracker.atlassian.net/browse/BIT-1949.
|
||||||
bool EqualTo(const TableVal* v) const;
|
bool EqualTo(const TableVal& v) const;
|
||||||
|
|
||||||
|
[[deprecated("Remove in v4.1. Pass TableVal& instead.")]]
|
||||||
|
bool EqualTo(const TableVal* v) const
|
||||||
|
{ return EqualTo(*v); }
|
||||||
|
|
||||||
// Returns true if this set is a subset (not necessarily proper)
|
// Returns true if this set is a subset (not necessarily proper)
|
||||||
// of the given set.
|
// of the given set.
|
||||||
bool IsSubsetOf(const TableVal* v) const;
|
bool IsSubsetOf(const TableVal& v) const;
|
||||||
|
|
||||||
|
[[deprecated("Remove in v4.1. Pass TableVal& instead.")]]
|
||||||
|
bool IsSubsetOf(const TableVal* v) const
|
||||||
|
{ return IsSubsetOf(*v); }
|
||||||
|
|
||||||
// Expands any lists in the index into multiple initializations.
|
// Expands any lists in the index into multiple initializations.
|
||||||
// Returns true if the initializations typecheck, false if not.
|
// Returns true if the initializations typecheck, false if not.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue