mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
AK: Make ByteBuffer::try_* functions return ErrorOr<void>
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
This commit is contained in:
parent
88b6428c25
commit
a15ed8743d
20 changed files with 59 additions and 70 deletions
|
@ -75,7 +75,7 @@ bool Heap::write_block(u32 block, ByteBuffer& buffer)
|
|||
VERIFY(buffer.size() <= BLOCKSIZE);
|
||||
auto sz = buffer.size();
|
||||
if (sz < BLOCKSIZE) {
|
||||
if (!buffer.try_resize(BLOCKSIZE))
|
||||
if (buffer.try_resize(BLOCKSIZE).is_error())
|
||||
return false;
|
||||
memset(buffer.offset_pointer((int)sz), 0, BLOCKSIZE - sz);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue