mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Change TableVal::ToMap() to return ValPtr-indexed maps
This commit is contained in:
parent
583310f6dd
commit
c0b8fc4d60
2 changed files with 4 additions and 6 deletions
|
@ -2311,9 +2311,9 @@ ListValPtr TableVal::ToPureListVal() const
|
||||||
return ToListVal(tl[0]->Tag());
|
return ToListVal(tl[0]->Tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<Val*, ValPtr> TableVal::ToMap() const
|
std::unordered_map<ValPtr, ValPtr> TableVal::ToMap() const
|
||||||
{
|
{
|
||||||
std::unordered_map<Val*, ValPtr> res;
|
std::unordered_map<ValPtr, ValPtr> res;
|
||||||
|
|
||||||
for ( const auto& iter : *table_val )
|
for ( const auto& iter : *table_val )
|
||||||
{
|
{
|
||||||
|
@ -2321,7 +2321,7 @@ std::unordered_map<Val*, ValPtr> TableVal::ToMap() const
|
||||||
auto v = iter.GetValue<TableEntryVal*>();
|
auto v = iter.GetValue<TableEntryVal*>();
|
||||||
auto vl = table_hash->RecoverVals(*k);
|
auto vl = table_hash->RecoverVals(*k);
|
||||||
|
|
||||||
res[vl.release()] = v->GetVal();
|
res[std::move(vl)] = v->GetVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -896,9 +896,7 @@ public:
|
||||||
ListValPtr ToPureListVal() const;
|
ListValPtr ToPureListVal() const;
|
||||||
|
|
||||||
// Returns a map of index-to-value's. The value is nil for sets.
|
// Returns a map of index-to-value's. The value is nil for sets.
|
||||||
// It's up to the caller to Unref() the index Val* when done
|
std::unordered_map<ValPtr, ValPtr> ToMap() const;
|
||||||
// with it.
|
|
||||||
std::unordered_map<Val*, ValPtr> ToMap() const;
|
|
||||||
|
|
||||||
void SetAttrs(detail::AttributesPtr attrs);
|
void SetAttrs(detail::AttributesPtr attrs);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue