mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 00:42:14 +00:00
Everywhere: Use OOM-safe ByteBuffer APIs where possible
If we can easily communicate failure, let's avoid asserting and report failure instead.
This commit is contained in:
parent
6606993432
commit
3a9f00c59b
22 changed files with 135 additions and 67 deletions
|
@ -75,7 +75,8 @@ bool Heap::write_block(u32 block, ByteBuffer& buffer)
|
|||
VERIFY(buffer.size() <= BLOCKSIZE);
|
||||
auto sz = buffer.size();
|
||||
if (sz < BLOCKSIZE) {
|
||||
buffer.resize(BLOCKSIZE);
|
||||
if (!buffer.try_resize(BLOCKSIZE))
|
||||
return false;
|
||||
memset(buffer.offset_pointer((int)sz), 0, BLOCKSIZE - sz);
|
||||
}
|
||||
dbgln_if(SQL_DEBUG, "{:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue