mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
nic_router: destroy_each for domain tree
List method to destruct and deallocate each item of a domain tree. Ref #2670
This commit is contained in:
parent
d5f645ee69
commit
44dd55a268
@ -266,6 +266,7 @@ Domain &Domain_tree::domain(Avl_string_base const &node)
|
||||
return static_cast<Domain_avl_member const *>(&node)->domain();
|
||||
}
|
||||
|
||||
|
||||
Domain &Domain_tree::find_by_name(Domain_name name)
|
||||
{
|
||||
if (name == Domain_name() || !first()) {
|
||||
@ -277,3 +278,13 @@ Domain &Domain_tree::find_by_name(Domain_name name)
|
||||
|
||||
return domain(*node);
|
||||
}
|
||||
|
||||
|
||||
void Domain_tree::destroy_each(Deallocator &dealloc)
|
||||
{
|
||||
while (Avl_string_base *first_ = first()) {
|
||||
Domain &domain_ = domain(*first_);
|
||||
remove(first_);
|
||||
destroy(dealloc, &domain_);
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +203,8 @@ struct Net::Domain_tree : Genode::Avl_tree<Genode::Avl_string_base>
|
||||
}
|
||||
|
||||
void insert(Domain &domain) { Avl_tree::insert(&domain.avl_member()); }
|
||||
|
||||
void destroy_each(Genode::Deallocator &dealloc);
|
||||
};
|
||||
|
||||
#endif /* _DOMAIN_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user