BufDeinit
Description
Release the backing storage of a Buf through its inline allocator.
Success
Returns to the caller. *b is zeroed.
Failure
Macro cannot fail. Safe on a zeroed Buf.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pe.c:562:
Buf data = BufInit(alloc);
if (FileReadAndClose(path, &data) < 0) {
BufDeinit(&data);
LOG_ERROR("PeOpen: failed to read {}", path);
return false;- In
Pe.c:572:
if (!self)
return;
BufDeinit(&self->data);
VecDeinit(&self->sections);
MemSet(self, 0, sizeof(*self));- In
Pdb.c:750:
Buf data = BufInit(alloc);
if (FileReadAndClose(path, &data) < 0) {
BufDeinit(&data);
LOG_ERROR("PdbOpen: failed to read {}", path);
return false;- In
Pdb.c:773:
StrDeinit(&self->name_pool);
VecDeinit(&self->functions);
BufDeinit(&self->data);
MemSet(self, 0, sizeof(*self));
}- In
Tzif.c:192:
Buf data = BufInit(alloc);
if (FileReadAndClose("/etc/localtime", &data) < 0) {
BufDeinit(&data);
LOG_ERROR("Tzif: cannot read /etc/localtime");
return false;- In
Tzif.c:197:
}
bool ok = TzifOffsetFromBuf(BufData(&data), BufLength(&data), unix_seconds, out_offset_seconds);
BufDeinit(&data);
return ok;
}- In
MachO.c:467:
Buf data = BufInit(alloc);
if (FileReadAndClose(path, &data) < 0) {
BufDeinit(&data);
LOG_ERROR("MachoOpen: failed to read {}", path);
return false;- In
MachO.c:477:
if (!self)
return;
BufDeinit(&self->data);
VecDeinit(&self->segments);
VecDeinit(&self->sections);- In
Elf.c:531:
Buf data = BufInit(alloc);
if (FileReadAndClose(path, &data) < 0) {
BufDeinit(&data);
LOG_ERROR("ElfOpen: failed to read {}", path);
return false;- In
Elf.c:541:
if (!self)
return;
BufDeinit(&self->data);
VecDeinit(&self->sections);
VecDeinit(&self->segments);- In
File.c:838:
ok = ok && (got == (i64)N) && (BufLength(&dst) == (size)N) && (MemCompare(BufData(&dst), BufData(&src), N) == 0);
BufDeinit(&src);
BufDeinit(&dst);
FileRemove(&path);- In
File.c:839:
BufDeinit(&src);
BufDeinit(&dst);
FileRemove(&path);
StrDeinit(&path);- In
File.c:942:
StrDeinit(&body);
BufDeinit(&in);
FileRemove(&path);
StrDeinit(&path);- In
Buf.c:22:
BufClear(&b);
ok = ok && BufLength(&b) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:45:
};
bool ok = BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:59:
const u8 expect_uleb[] = {0x00, 0x7F, 0x80, 0x01, 0x80, 0x80, 0x01};
if (BufLength(&b) != sizeof(expect_uleb) || MemCompare(BufData(&b), expect_uleb, sizeof(expect_uleb)) != 0) {
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return false;- In
Buf.c:72:
bool ok = BufLength(&b) == sizeof(expect_sleb) && MemCompare(BufData(&b), expect_sleb, sizeof(expect_sleb)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:83:
const u8 expect[] = {'h', 'i', 0};
bool ok = BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:108:
ok = ok && IterRemainingLength(&it) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:126:
ok = ok && IterRemainingLength(&it) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:143:
ok = ok && IterRemainingLength(&it) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:159:
const u8 expect[] = {0x99, 0xFE, 0xCA, 0xDE, 0xAD, 0xBE, 0xEF};
ok = ok && BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:173:
const u8 expect[] = {0x34, 0x12};
ok = ok && BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:208:
ok = ok && BufLength(&b) == BufLength(&snapshot);
ok = ok && MemCompare(BufData(&b), BufData(&snapshot), BufLength(&b)) == 0;
BufDeinit(&snapshot);
BufDeinit(&b);- In
Buf.c:210:
BufDeinit(&snapshot);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:228:
ok = ok && IterRemainingLength(&it) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Buf.c:246:
ok = ok && it.pos == entry && v32 == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:728:
bool ok = ZstrCompare(StrBegin(&output), "hello") == 0;
BufDeinit(&b);
StrDeinit(&output);
DefaultAllocatorDeinit(&alloc);- In
Write.c:811:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:848:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:867:
ok = ok && BufReadFmt(&it, "{{{>1r}", v) && (v == 0x41);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:898:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:1864:
ok = ok && rd && (v8 == 0x05);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:1890:
ok = ok && rd && (v32 == 0xDEADBEEF);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:1914:
ok = ok && rd && (v64 == 0x0102030405060708ULL);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:1938:
ok = ok && rd && (v64 == -1234567890123LL);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:1967:
BufReadFmt(&it, "{2}", v16); // real: LOG_FATAL (non-raw). mutant: returns.
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return true; // unreached on real code (aborts above)
- In
Write.c:3513:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3537:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3567:
}
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3583:
const u8 expect[] = {0x7E};
ok = ok && BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3599:
const u8 expect[] = {0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
ok = ok && BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3617:
const u8 expect[] = {0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
ok = ok && BufLength(&b) == sizeof(expect) && MemCompare(BufData(&b), expect, sizeof(expect)) == 0;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3699:
bool ok = BufWriteFmt(&b, "{<1r}", (u8)0xAB);
ok = ok && (BufLength(&b) == 1) && (BufData(&b)[0] == 0xAB);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3739:
Buf b = BufInit(&alloc);
BufWriteFmt(&b, "{4}", (u32)0x11223344); // real: LOG_FATAL before return
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return true;- In
Write.c:3807:
bool ok = r && (BufLength(&b) == 4) && d[0] == 0xAA && d[1] == 0xBB && d[2] == 0xCC && d[3] == 0xDD;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3901:
ok = ok && (BufLength(&b) == 2) && d[0] == 0x12 && d[1] == 0x34;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3915:
ok = ok && (BufLength(&b) == 2) && d[0] == 0x34 && d[1] == 0x12;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3928:
ok = ok && (BufLength(&b) == 4) && d[0] == 0x44 && d[1] == 0x33 && d[2] == 0x22 && d[3] == 0x11;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:3942:
d[5] == 0x03 && d[6] == 0x02 && d[7] == 0x01;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:4099:
ok = ok && (v64 == 0x0102030405060708ULL);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:4634:
ok = ok && rd_ok && (v16 == 0x1234);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Write.c:4763:
u8 v8 = 0;
BufReadFmt(&it, "{<1r}{<1r}", v8); // 2 fields, 1 arg -> abort
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return true;- In
Write.c:5056:
u32 c = 0;
ok = ok && BufReadFmt(&it, "{<2r}{>4r}", a, c) && a == 0x1234 && c == 0xAABBCCDD;
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1226:
ok = ok && rd_ok && (v32 == 0x12345678u);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1259:
ok = ok && rd_ok && (v32 == 0x12345678u);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1284:
ok = ok && rd_ok && (v32 == 0x78563412u);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1319:
ok = ok && rd_ok && (v32 == 0xAABBCCDDu);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1361:
ok = ok && rd_ok && (v64 == expected);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1388:
ok = ok && rd_ok && (v64 == expected);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1418:
ok = ok && rd_ok && (v64 == expected);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:1598:
ok = ok && BufReadFmt(&it, "{<1r}", out) && (out == 0xAB);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:2222:
u16 v = 0;
ok = ok && BufReadFmt(&it, "{<2r}", v) && (v == 0xBEEF);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Read.c:2239:
BufIter it = BufIterFromBuf(&b);
ok = ok && BufReadFmt(&it, "{<8r}", got.f) && (got.u == 0x0102030405060708ULL);
BufDeinit(&b);
DefaultAllocatorDeinit(&alloc);
return ok;- In
Tzif.c:73:
off = 0;
ok = ok && resolve(&b, 2500000, &off) && off == -18000; // >= t1 -> STD
BufDeinit(&b);
DefaultAllocatorDeinit(&a);
return ok;- In
Tzif.c:90:
off = 0;
ok = ok && resolve(&b, 2500000000, &off) && off == 19800; // >= t1 -> STD
BufDeinit(&b);
DefaultAllocatorDeinit(&a);
return ok;- In
Tzif.c:119:
i32 off = 0;
bool ok = TzifOffsetFromBuf(BufData(&b), BufLength(&b), 0, &off);
BufDeinit(&b);
DefaultAllocatorDeinit(&a);
return ok && off == -18000;- In
Tzif.c:133:
i32 off = 7;
bool ok = TzifOffsetFromBuf(BufData(&b), BufLength(&b), 0, &off);
BufDeinit(&b);
DefaultAllocatorDeinit(&a);
return !ok;- In
Tzif.c:151:
i32 off = 7;
bool ok = TzifOffsetFromBuf(BufData(&b), BufLength(&b), 0, &off);
BufDeinit(&b);
DefaultAllocatorDeinit(&a);
return !ok;
Last updated on