summaryrefslogtreecommitdiff
path: root/Kernel/KBuffer.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-07 15:22:24 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-07 15:22:24 +0200
commit250b52d6e5ef4b57048ef7f52a02ebb2fb87780b (patch)
treeae1fcf16f632c159ee967073185acadd63a37670 /Kernel/KBuffer.h
parent899cee8185d06c7fe9b08e6b1a846cd6bc4363e1 (diff)
downloadserenity-250b52d6e5ef4b57048ef7f52a02ebb2fb87780b.zip
Kernel: Make KBuffer::try_create_with_bytes() return KResultOr
Diffstat (limited to 'Kernel/KBuffer.h')
-rw-r--r--Kernel/KBuffer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/KBuffer.h b/Kernel/KBuffer.h
index 7ac17dbe96..9091a9578e 100644
--- a/Kernel/KBuffer.h
+++ b/Kernel/KBuffer.h
@@ -114,12 +114,12 @@ public:
return adopt_nonnull_own_or_enomem(new (nothrow) KBuffer(impl.release_nonnull()));
}
- [[nodiscard]] static OwnPtr<KBuffer> try_create_with_bytes(ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
+ static KResultOr<NonnullOwnPtr<KBuffer>> try_create_with_bytes(ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
{
auto impl = KBufferImpl::try_create_with_bytes(bytes, access, name, strategy);
if (!impl)
- return {};
- return adopt_own_if_nonnull(new (nothrow) KBuffer(impl.release_nonnull()));
+ return ENOMEM;
+ return adopt_nonnull_own_or_enomem(new (nothrow) KBuffer(impl.release_nonnull()));
}
[[nodiscard]] static KBuffer copy(const void* data, size_t size, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer")