Skip to content
PdbOpenFromMemory

PdbOpenFromMemory

Description

Open and parse a PDB from an in-memory byte range – L-value / ownership-transfer form (mirrors VecInsertL).

data is u8 **: ownership is moving from caller to parser. On entry *data is the caller’s buffer (allocated through alloc); on exit (success OR failure) *data == NULL. Calling code:

u8 *buf = my_buffer; PdbOpenFromMemory(&pdb, &buf, n, &alloc); // buf == NULL afterwards.

Success

Returns true; out owns the bytes; *data == NULL.

Failure

Returns false; the bytes have been freed through alloc; *data == NULL; out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
    // L-value form. `data` is `u8 **` -- ownership of the pointer moves
    // from caller to parser. On exit `*data == NULL` (success or failure).
    bool PdbOpenFromMemory(Pdb *out, Buf *in) {
        if (!out || !in || !in->data || !in->allocator) {
            LOG_FATAL("PdbOpenFromMemory: NULL argument (contract violation)");
    bool PdbOpenFromMemory(Pdb *out, Buf *in) {
        if (!out || !in || !in->data || !in->allocator) {
            LOG_FATAL("PdbOpenFromMemory: NULL argument (contract violation)");
        }
        Buf taken = *in;
        MemCopy(BufData(&copy), data, data_size);
        copy.length = (size)data_size;
        return PdbOpenFromMemory(out, &copy);
    }
            return false;
        }
        return PdbOpenFromMemory(out, &data);
    }
Last updated on