mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Kernel: Use WeakPtr<NetworkAdapter> instead of NetworkAdapter* in net code
This commit is contained in:
committed by
Andreas Kling
parent
d6bce37756
commit
54ceabd48d
@@ -22,12 +22,12 @@ void NetworkAdapter::for_each(Function<void(NetworkAdapter&)> callback)
|
||||
callback(*it);
|
||||
}
|
||||
|
||||
NetworkAdapter* NetworkAdapter::from_ipv4_address(const IPv4Address& address)
|
||||
WeakPtr<NetworkAdapter> NetworkAdapter::from_ipv4_address(const IPv4Address& address)
|
||||
{
|
||||
LOCKER(all_adapters().lock());
|
||||
for (auto* adapter : all_adapters().resource()) {
|
||||
if (adapter->ipv4_address() == address)
|
||||
return adapter;
|
||||
return adapter->make_weak_ptr();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user