mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Val: TableVal::Delete() returns IntrusivePtr
This commit is contained in:
parent
6495193aae
commit
d2961c72e1
4 changed files with 10 additions and 12 deletions
10
src/Val.cc
10
src/Val.cc
|
@ -1598,7 +1598,7 @@ int TableVal::RemoveFrom(Val* val) const
|
|||
// OTOH, they are both the same type, so as long as
|
||||
// we don't have hash keys that are keyed per dictionary,
|
||||
// it should work ...
|
||||
Unref(t->Delete(k));
|
||||
t->Delete(k);
|
||||
delete k;
|
||||
}
|
||||
|
||||
|
@ -2000,7 +2000,7 @@ void TableVal::CallChangeFunc(const Val* index, Val* old_value, OnChangeType tpe
|
|||
in_change_func = false;
|
||||
}
|
||||
|
||||
Val* TableVal::Delete(const Val* index)
|
||||
IntrusivePtr<Val> TableVal::Delete(const Val* index)
|
||||
{
|
||||
HashKey* k = ComputeHash(index);
|
||||
TableEntryVal* v = k ? AsNonConstTable()->RemoveEntry(k) : 0;
|
||||
|
@ -2017,10 +2017,10 @@ Val* TableVal::Delete(const Val* index)
|
|||
if ( change_func )
|
||||
CallChangeFunc(index, va.get(), ELEMENT_REMOVED);
|
||||
|
||||
return va.release();
|
||||
return va;
|
||||
}
|
||||
|
||||
Val* TableVal::Delete(const HashKey* k)
|
||||
IntrusivePtr<Val> TableVal::Delete(const HashKey* k)
|
||||
{
|
||||
TableEntryVal* v = AsNonConstTable()->RemoveEntry(k);
|
||||
IntrusivePtr<Val> va{NewRef{}, v ? (v->Value() ? v->Value() : this) : nullptr};
|
||||
|
@ -2042,7 +2042,7 @@ Val* TableVal::Delete(const HashKey* k)
|
|||
CallChangeFunc(index.get(), va.get(), ELEMENT_REMOVED);
|
||||
}
|
||||
|
||||
return va.release();
|
||||
return va;
|
||||
}
|
||||
|
||||
ListVal* TableVal::ConvertToList(TypeTag t) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue