1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 03:47:34 +00:00

Kernel: Make KBuffer a value-type wrapper around a KBufferImpl

A KBuffer always contains a valid KBufferImpl. If you need a "null"
state buffer, use Optional<KBuffer>.

This makes KBuffer very easy to work with and pass around, just like
ByteBuffer before it.
This commit is contained in:
Andreas Kling 2019-08-05 11:06:21 +02:00
parent 52cfe9ebae
commit 605975adb5
6 changed files with 50 additions and 22 deletions

View file

@ -84,7 +84,7 @@ void NetworkAdapter::did_receive(const u8* data, int length)
m_packet_queue.append(KBuffer::copy(data, length));
}
RefPtr<KBuffer> NetworkAdapter::dequeue_packet()
Optional<KBuffer> NetworkAdapter::dequeue_packet()
{
InterruptDisabler disabler;
if (m_packet_queue.is_empty())