mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
Kernel: Tidy up UDPSocket creation a bit
- Rename create() => try_create() - Use adopt_nonnull_ref_or_enomem()
This commit is contained in:
@@ -54,12 +54,9 @@ UDPSocket::~UDPSocket()
|
||||
});
|
||||
}
|
||||
|
||||
KResultOr<NonnullRefPtr<UDPSocket>> UDPSocket::create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer)
|
||||
KResultOr<NonnullRefPtr<UDPSocket>> UDPSocket::try_create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer)
|
||||
{
|
||||
auto socket = adopt_ref_if_nonnull(new (nothrow) UDPSocket(protocol, move(receive_buffer)));
|
||||
if (socket)
|
||||
return socket.release_nonnull();
|
||||
return ENOMEM;
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) UDPSocket(protocol, move(receive_buffer)));
|
||||
}
|
||||
|
||||
KResultOr<size_t> UDPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, [[maybe_unused]] int flags)
|
||||
|
||||
Reference in New Issue
Block a user