Skip to content

BufResize

Description

Set b’s length to exactly n bytes, growing the backing store if necessary. New bytes are zero-initialized; existing bytes past n are dropped.

Success

Returns true; b->length == n. b->data may have moved when growing.

Failure

Returns false if the underlying allocator fails to grow the buffer; *b is unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
        }
        MemCopy(copy.data, data, data_size);
        BufResize(&copy, (size)data_size);
        return MachoOpenFromMemory(out, &copy);
    }
        }
        MemCopy(copy.data, data, data_size);
        BufResize(&copy, (size)data_size);
        // Hand `&copy` to the L-form -- it consumes the local and zeros
        // it. The local goes out of scope right after.
        }
        MemCopy(BufData(&copy), data, data_size);
        BufResize(&copy, (size)data_size);
        return PdbOpenFromMemory(out, &copy);
    }
        }
        MemCopy(BufData(&copy), data, data_size);
        BufResize(&copy, (size)data_size);
        return PeOpenFromMemory(out, &copy);
    }
Last updated on