Skip to content

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)
        }
        Buf copy = BufInit(alloc);
        if (!BufReserve(&copy, (u64)data_size)) {
            LOG_ERROR("PdbOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
            return false;
        }
        Buf copy = BufInit(alloc);
        if (!BufReserve(&copy, (u64)data_size)) {
            LOG_ERROR("PeOpenFromMemoryCopy: allocation failed ({} bytes)", (u64)data_size);
            return false;
Last updated on