mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +00:00
Kernel: Remove KBuffer::is_null() and bogus call sites :^)
This commit is contained in:
parent
1a04dc9cba
commit
881923dd47
|
@ -38,8 +38,6 @@ DoubleBuffer::DoubleBuffer(size_t capacity, NonnullOwnPtr<KBuffer> storage)
|
|||
|
||||
void DoubleBuffer::flip()
|
||||
{
|
||||
if (m_storage->is_null())
|
||||
return;
|
||||
VERIFY(m_read_buffer_index == m_read_buffer->size);
|
||||
swap(m_read_buffer, m_write_buffer);
|
||||
m_write_buffer->size = 0;
|
||||
|
@ -49,7 +47,7 @@ void DoubleBuffer::flip()
|
|||
|
||||
KResultOr<size_t> DoubleBuffer::write(const UserOrKernelBuffer& data, size_t size)
|
||||
{
|
||||
if (!size || m_storage->is_null())
|
||||
if (!size)
|
||||
return 0;
|
||||
MutexLocker locker(m_lock);
|
||||
size_t bytes_to_write = min(size, m_space_for_writing);
|
||||
|
@ -64,7 +62,7 @@ KResultOr<size_t> DoubleBuffer::write(const UserOrKernelBuffer& data, size_t siz
|
|||
|
||||
KResultOr<size_t> DoubleBuffer::read(UserOrKernelBuffer& data, size_t size)
|
||||
{
|
||||
if (!size || m_storage->is_null())
|
||||
if (!size)
|
||||
return 0;
|
||||
MutexLocker locker(m_lock);
|
||||
if (m_read_buffer_index >= m_read_buffer->size && m_write_buffer->size != 0)
|
||||
|
@ -82,7 +80,7 @@ KResultOr<size_t> DoubleBuffer::read(UserOrKernelBuffer& data, size_t size)
|
|||
|
||||
KResultOr<size_t> DoubleBuffer::peek(UserOrKernelBuffer& data, size_t size)
|
||||
{
|
||||
if (!size || m_storage->is_null())
|
||||
if (!size)
|
||||
return 0;
|
||||
MutexLocker locker(m_lock);
|
||||
if (m_read_buffer_index >= m_read_buffer->size && m_write_buffer->size != 0) {
|
||||
|
|
|
@ -113,8 +113,6 @@ public:
|
|||
return adopt_nonnull_own_or_enomem(new (nothrow) KBuffer(impl.release_nonnull()));
|
||||
}
|
||||
|
||||
[[nodiscard]] bool is_null() const { return false; }
|
||||
|
||||
[[nodiscard]] u8* data() { return m_impl->data(); }
|
||||
[[nodiscard]] const u8* data() const { return m_impl->data(); }
|
||||
[[nodiscard]] size_t size() const { return m_impl->size(); }
|
||||
|
|
Loading…
Reference in a new issue