PdbOpenFromMemory
Description
Open and parse a PDB from an in-memory byte range – L-value / ownership-transfer form (mirrors VecInsertL).
Takes the caller’s Buf by pointer. The parser snapshots the Buf and zeroes the caller’s *in so any post-call use sees an empty Buf instead of a stale alias. Allocator comes from the Buf. The zero-on-take invariant holds on success and failure.
Usage example (from documentation)
Buf buf = BufInit(&alloc);
FileRead(&f, &buf);
PdbOpenFromMemory(&pdb, &buf);
// buf is now zeroed.
Success
Returns true; out owns the bytes; *in is zeroed.
Failure
Returns false; the bytes have been freed through the Buf’s allocator; *in is zeroed; out is left zeroed.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pdb.c:697:
// then MemSets the caller's view. On exit `*in` is zeroed (success
// or failure); allocator and bytes are carried by `taken`.
bool PdbOpenFromMemory(Pdb *out, Buf *in) {
if (!out || !in || !BufData(in) || !BufAllocator(in)) {
LOG_FATAL("PdbOpenFromMemory: NULL argument (contract violation)");- In
Pdb.c:699:
bool PdbOpenFromMemory(Pdb *out, Buf *in) {
if (!out || !in || !BufData(in) || !BufAllocator(in)) {
LOG_FATAL("PdbOpenFromMemory: NULL argument (contract violation)");
}
Buf taken = *in;- In
Pdb.c:741:
MemCopy(BufData(©), data, data_size);
BufResize(©, (size)data_size);
return PdbOpenFromMemory(out, ©);
}- In
Pdb.c:754:
return false;
}
return PdbOpenFromMemory(out, &data);
}- In
Pdb.c:2404:
Pdb pdb;
bool open_ok = PdbOpenFromMemory(&pdb, &in);
// Expect failure (bogus info block id).
bool ok = !open_ok;
Last updated on