BufReserve
Description
Ensure b has capacity for at least n bytes without changing its length. Allocates only when the existing capacity is below n.
Success
Returns true; b->data may have moved.
Failure
Returns false if the underlying allocator fails to grow the buffer; *b is unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pe.c:547:
}
Buf copy = BufInit(alloc);
if (!BufReserve(©, (u64)data_size)) {
LOG_ERROR("PeOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
return false;- In
Pdb.c:735:
}
Buf copy = BufInit(alloc);
if (!BufReserve(©, (u64)data_size)) {
LOG_ERROR("PdbOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
return false;- In
Pdb.c:2396:
// a copy buffer through `base`, handed to PdbOpenFromMemory.
Buf in = BufInit(base);
if (!BufReserve(&in, sizeof(sblob))) {
DebugAllocatorDeinit(&dbg);
return false;
Last updated on