LOG_FATAL
Description
on the diagnostic channel before Abort() runs.
…[in] : Format string and arguments.
Success
Message logged and program aborted via Abort()
Failure
Logging may fail silently, but Abort() will still execute
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Allocator.c:43:
void ValidateAllocator(const Allocator *self) {
if (!self) {
LOG_FATAL("NULL allocator pointer");
}
if (self->__magic == 0u) {- In
Allocator.c:46:
}
if (self->__magic == 0u) {
LOG_FATAL("Allocator uninitialized (__magic is zero)");
}
if (!self->allocate || !self->resize || !self->remap || !self->deallocate) {- In
Allocator.c:49:
}
if (!self->allocate || !self->resize || !self->remap || !self->deallocate) {
LOG_FATAL("Allocator missing required function pointers");
}
if (!allocator_alignment_is_pow2(self->alignment)) {- In
Allocator.c:52:
}
if (!allocator_alignment_is_pow2(self->alignment)) {
LOG_FATAL("Allocator alignment must be a power of two > 0");
}
}- In
Memory.c:16:
if (!p1 || !p2) {
LOG_FATAL("Invalid arguments");
}- In
Memory.c:37:
if (!dst || !src) {
LOG_FATAL("Invalid arguments");
}- In
Memory.c:54:
if (!dst || !src) {
LOG_FATAL("Invalid arguments");
}- In
Memory.c:79:
if (!dst) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:13:
size ZstrLen(Zstr str) {
if (!str) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:24:
i32 ZstrCompare(Zstr s1, Zstr s2) {
if (!s1 || !s2) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:45:
if (!key || !*key) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:64:
if (!a || !b || !*a || !*b) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:79:
i32 ZstrCompareN(Zstr s1, Zstr s2, size n) {
if (!s1 || !s2) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:101:
i32 ZstrCompareIgnoreCase(Zstr s1, Zstr s2) {
if (!s1 || !s2) {
LOG_FATAL("Invalid arguments");
}
while (*s1) {- In
Zstr.c:117:
i32 ZstrCompareNIgnoreCase(Zstr s1, Zstr s2, size n) {
if (!s1 || !s2) {
LOG_FATAL("Invalid arguments");
}
size i = 0;- In
Zstr.c:136:
Zstr ZstrFindChar(Zstr str, char ch) {
if (!str) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:150:
Zstr zstr_dup_n(Zstr src, size n, Allocator *alloc) {
if (!src || !alloc) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:173:
Zstr zstr_dup(Zstr src, Allocator *alloc) {
if (!src) {
LOG_FATAL("Invalid arguments");
}
return zstr_dup_n(src, ZstrLen(src), alloc);- In
Zstr.c:183:
if (!dst || !src || !*src || !alloc) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:194:
if (!zs || !alloc) {
LOG_FATAL("Invalid arguments");
}- In
Zstr.c:333:
Zstr ZstrFindSubstring(Zstr haystack, Zstr needle) {
if (!needle) {
LOG_FATAL("Invalid arguments");
}
return ZstrFindSubstringN(haystack, needle, ZstrLen(needle));- In
Zstr.c:340:
Zstr ZstrFindSubstringN(Zstr haystack, Zstr needle, size needle_len) {
if (!haystack || !needle) {
LOG_FATAL("Invalid arguments");
}
if (needle_len == 0) {- In
Io.c:111:
static bool parse_format_spec(Zstr spec, u32 len, FmtInfo *fi) {
if (!spec || !fi) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:295:
bool str_append_fmt(Str *o, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:354:
}
#else
LOG_FATAL("Invalid writer or data pointer");
#endif
}- In
Io.c:482:
bool str_write_fmt(Str *o, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:491:
bool str_patch_fmt(Str *o, size offset, Zstr fmt, TypeSpecificIO *args, u64 argc) {
if (!o || !fmt) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:527:
if (!stream || !fmtstr) {
LOG_FATAL("Invalid arguments");
DefaultAllocatorDeinit(&scratch);
return false;- In
Io.c:560:
Zstr str_read_fmt(Zstr input, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
if (!input || !fmtstr) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:814:
bool buf_read_fmt(BufIter *iter, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
if (!iter || !fmtstr) {
LOG_FATAL("buf_read_fmt: NULL iter or fmtstr");
}- In
Io.c:824:
while (StrIterPeek(&fsi, &fc)) {
if (fc != '{') {
LOG_FATAL("buf_read_fmt: stray '{c}' in binary fmt; only {{<Nr}} / {{>Nr}} allowed", (u32)(u8)fc);
}
StrIterMustNext(&fsi); // step over '{'
- In
Io.c:834:
}
if (sc != '}') {
LOG_FATAL("buf_read_fmt: unterminated {{ in fmt");
}
u32 spec_len = (u32)(StrIterRemainingLength(&spec_start_fsi) - StrIterRemainingLength(&fsi));- In
Io.c:844:
}
if (!(fmt_info.flags & FMT_FLAG_RAW)) {
LOG_FATAL("buf_read_fmt: only raw ({{<Nr}}/{{>Nr}}) specs allowed");
}
if (fmt_info.width != 1 && fmt_info.width != 2 && fmt_info.width != 4 && fmt_info.width != 8) {- In
Io.c:847:
}
if (fmt_info.width != 1 && fmt_info.width != 2 && fmt_info.width != 4 && fmt_info.width != 8) {
LOG_FATAL("buf_read_fmt: raw width must be 1/2/4/8 (got {})", (u64)fmt_info.width);
}
// Bounds check in iter space; pointer arithmetic stays inside the buffer.
- In
Io.c:855:
}
if (arg_index >= argc) {
LOG_FATAL("buf_read_fmt: too few arguments for format string");
}
TypeSpecificIO *io = &argv[arg_index++];- In
Io.c:859:
TypeSpecificIO *io = &argv[arg_index++];
if (!io->reader) {
LOG_FATAL("buf_read_fmt: argument {} has no reader", arg_index - 1);
}- In
Io.c:912:
var_width = 8;
} else {
LOG_FATAL("buf_read_fmt: unsupported variable type at arg {}", arg_index - 1);
}
if (fmt_info.width != var_width) {- In
Io.c:915:
}
if (fmt_info.width != var_width) {
LOG_FATAL(
"buf_read_fmt: spec width {} doesn't match variable width {} at arg {}",
(u64)fmt_info.width,- In
Io.c:942:
if (arg_index != argc) {
LOG_FATAL("buf_read_fmt: {} unused argument(s) at end of format", argc - arg_index);
}
return true;- In
Io.c:953:
static bool render_one_raw_field(Str *out, FmtInfo *fmt_info, TypeSpecificIO *io, u64 arg_index) {
if (!io->writer) {
LOG_FATAL("buf_*_fmt: argument {} has no writer", arg_index);
}
void *write_fn = (void *)io->writer;- In
Io.c:966:
var_width = 8;
} else {
LOG_FATAL("buf_*_fmt: unsupported variable type at arg {}", arg_index);
}
if (fmt_info->width != var_width) {- In
Io.c:969:
}
if (fmt_info->width != var_width) {
LOG_FATAL(
"buf_*_fmt: spec width {} doesn't match variable width {} at arg {}",
(u64)fmt_info->width,- In
Io.c:1007:
while (StrIterPeek(&fsi, &fc)) {
if (fc != '{') {
LOG_FATAL("buf_*_fmt: stray '{c}' in binary fmt; only {{<Nr}} / {{>Nr}} allowed", (u32)(u8)fc);
}
StrIterMustNext(&fsi); // step over '{'
- In
Io.c:1017:
}
if (sc != '}') {
LOG_FATAL("buf_*_fmt: unterminated {{ in fmt");
}
u32 spec_len = (u32)(StrIterRemainingLength(&spec_start_fsi) - StrIterRemainingLength(&fsi));- In
Io.c:1026:
}
if (!(fmt_info.flags & FMT_FLAG_RAW)) {
LOG_FATAL("buf_*_fmt: only raw ({{<Nr}}/{{>Nr}}) specs allowed");
}
if (fmt_info.width != 1 && fmt_info.width != 2 && fmt_info.width != 4 && fmt_info.width != 8) {- In
Io.c:1029:
}
if (fmt_info.width != 1 && fmt_info.width != 2 && fmt_info.width != 4 && fmt_info.width != 8) {
LOG_FATAL("buf_*_fmt: raw width must be 1/2/4/8 (got {})", (u64)fmt_info.width);
}
if (arg_index >= argc) {- In
Io.c:1032:
}
if (arg_index >= argc) {
LOG_FATAL("buf_*_fmt: too few arguments for format string");
}
TypeSpecificIO *io = &argv[arg_index++];- In
Io.c:1041:
}
if (arg_index != argc) {
LOG_FATAL("buf_*_fmt: {} unused argument(s) at end of format", argc - arg_index);
}
return true;- In
Io.c:1048:
bool buf_append_fmt(Buf *out, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
if (!out || !fmtstr) {
LOG_FATAL("buf_append_fmt: NULL out or fmtstr");
}
// The raw-write helpers (_write_rN) emit into a Str. Buf is Vec(u8)
- In
Io.c:1057:
bool buf_write_fmt(Buf *out, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
if (!out || !fmtstr) {
LOG_FATAL("buf_write_fmt: NULL out or fmtstr");
}
VecClear(out);- In
Io.c:1065:
bool buf_patch_fmt(Buf *out, size offset, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
if (!out || !fmtstr) {
LOG_FATAL("buf_patch_fmt: NULL out or fmtstr");
}
// Render into a scratch Str so we know the byte count before
- In
Io.c:1099:
if (!file || !fmtstr) {
DefaultAllocatorDeinit(&scratch);
LOG_FATAL("Invalid arguments");
}- In
Io.c:1165:
static inline bool write_int_as_chars(Str *o, FormatFlags flags, u64 value, size num_bytes) {
if (!o || !num_bytes || num_bytes > 8) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1205:
static inline bool write_char_internal(Str *o, FormatFlags flags, Zstr vs, size len) {
if (!o || !vs || !len) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1288:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1333:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1429:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1518:
if (!input) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1570:
static inline Zstr read_chars_internal(Zstr i, u8 *buffer, size buffer_size, FmtInfo *fmt_info) {
if (!i || !buffer || !buffer_size) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1619:
bool _write_Str(Str *o, FmtInfo *fmt_info, Str *s) {
if (!o || !s || !fmt_info) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1706:
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s) {
if (!o || !s || !*s || !fmt_info) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1796:
if (!arg) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:1805:
bool _write_u64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1864:
bool _write_u32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1878:
bool _write_u16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1892:
bool _write_u8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1906:
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1964:
bool _write_i32(Str *o, FmtInfo *fmt_info, i32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1978:
bool _write_i16(Str *o, FmtInfo *fmt_info, i16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:1992:
bool _write_i8(Str *o, FmtInfo *fmt_info, i8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:2006:
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:2088:
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:2110:
if (!o || !fmt_info || !value) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:2118:
if (float_fmt_uses_unsupported_flags(fmt_info)) {
LOG_FATAL("Float only supports decimal and scientific formatting");
}- In
Io.c:2237:
Zstr _read_Str(Zstr i, FmtInfo *fmt_info, Str *s) {
if (!i || !s)
LOG_FATAL("Invalid arguments");
ValidateStr(s);- In
Io.c:2510:
if (!i || !v) {
DefaultAllocatorDeinit(&scratch);
LOG_FATAL("Invalid arguments");
}- In
Io.c:2631:
if (!i || !v) {
DefaultAllocatorDeinit(&scratch);
LOG_FATAL("Invalid arguments");
}- In
Io.c:2743:
if (!i || !v) { \
DefaultAllocatorDeinit(&scratch); \
LOG_FATAL("Invalid arguments"); \
} \
\
- In
Io.c:2843:
(void)fmt_info;
(void)out;
LOG_FATAL("Zstr reads require explicit allocator provenance; use ZstrIO(zstr, alloc) instead");
return i;
}- In
Io.c:2857:
if (!i || !arg || !arg->value || !arg->allocator) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:2906:
bool _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv) {
if (!o || !fmt_info || !bv) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:2980:
bool _write_Int(Str *o, FmtInfo *fmt_info, Int *value) {
if (!o || !fmt_info || !value) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:3045:
(void)fmt_info; // Unused parameter
if (!i || !bv) {
LOG_FATAL("Invalid arguments");
return i;
}- In
Io.c:3177:
Zstr _read_Int(Zstr i, FmtInfo *fmt_info, Int *value) {
if (!i || !value) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3269:
if (!i || !value) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3329:
if (!i || !v) {
DefaultAllocatorDeinit(&scratch);
LOG_FATAL("Invalid arguments");
}- In
Io.c:3450:
static bool _write_r8(Str *o, FmtInfo *fmt_info, u8 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:3459:
static bool _write_r16(Str *o, FmtInfo *fmt_info, u16 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:3477:
case ENDIAN_NATIVE :
default : {
LOG_FATAL("Invalid endianness");
return false;
}- In
Io.c:3485:
static bool _write_r32(Str *o, FmtInfo *fmt_info, u32 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:3505:
case ENDIAN_NATIVE :
default : {
LOG_FATAL("Invalid endianness");
return false;
}- In
Io.c:3513:
static bool _write_r64(Str *o, FmtInfo *fmt_info, u64 *v) {
if (!o || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
return false;
}- In
Io.c:3537:
case ENDIAN_NATIVE :
default : {
LOG_FATAL("Invalid endianness");
return false;
}- In
Io.c:3545:
static Zstr _read_r8(Zstr i, FmtInfo *fmt_info, u8 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3554:
static Zstr _read_r16(Zstr i, FmtInfo *fmt_info, u16 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3574:
case ENDIAN_NATIVE :
default :
LOG_FATAL("Invalid endianness");
}- In
Io.c:3582:
static Zstr _read_r32(Zstr i, FmtInfo *fmt_info, u32 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3600:
case ENDIAN_NATIVE :
default :
LOG_FATAL("Invalid endianness");
}- In
Io.c:3608:
static Zstr _read_r64(Zstr i, FmtInfo *fmt_info, u64 *v) {
if (!i || !fmt_info || !v) {
LOG_FATAL("Invalid arguments");
}- In
Io.c:3628:
case ENDIAN_NATIVE :
default :
LOG_FATAL("Invalid endianness");
}- In
Prng.c:37:
#if PLATFORM_WINDOWS
if (BCryptGenRandom(NULL, p, (unsigned long)rem, 2) != 0) { // BCRYPT_USE_SYSTEM_PREFERRED_RNG = 2
LOG_FATAL("Prng: BCryptGenRandom failed");
}
#elif FEATURE_DIRECT_SYSCALL- In
Prng.c:46:
long ret = direct_sys2(MISRA_SYS_getentropy, (long)(u64)p, chunk);
if (ret < 0) {
LOG_FATAL("Prng: getentropy failed");
}
p += chunk;- In
Prng.c:59:
continue;
}
LOG_FATAL("Prng: getrandom failed");
}
p += (u64)ret;- In
Prng.c:73:
return;
}
LOG_FATAL("Prng: no entropy source available");
#endif
}- In
ArgParse.c:424:
void arg_register(ArgParse *self, ArgRole role, Zstr short_name, Zstr long_name, Zstr help, ArgTarget target) {
if (!self)
LOG_FATAL("arg_register: NULL parser");
if (target.kind == ARG_KIND_INVALID) {
LOG_FATAL(- In
ArgParse.c:426:
LOG_FATAL("arg_register: NULL parser");
if (target.kind == ARG_KIND_INVALID) {
LOG_FATAL(
"arg_register: unsupported target type for '{}'",
long_name ? long_name : (short_name ? short_name : "<unnamed>")- In
ArgParse.c:432:
}
if (role == ARG_ROLE_FLAG && target.kind != ARG_KIND_BOOL) {
LOG_FATAL("arg_register: ArgFlag '{}' requires a bool* target", long_name ? long_name : short_name);
}
if (role == ARG_ROLE_COUNT && target.kind != ARG_KIND_U8 && target.kind != ARG_KIND_U16 &&- In
ArgParse.c:436:
if (role == ARG_ROLE_COUNT && target.kind != ARG_KIND_U8 && target.kind != ARG_KIND_U16 &&
target.kind != ARG_KIND_U32 && target.kind != ARG_KIND_U64) {
LOG_FATAL("arg_register: ArgCount '{}' requires a u8/u16/u32/u64* target", long_name ? long_name : short_name);
}
if (role == ARG_ROLE_POSITIONAL && !long_name) {- In
ArgParse.c:439:
}
if (role == ARG_ROLE_POSITIONAL && !long_name) {
LOG_FATAL("arg_register: ArgPositional needs a non-NULL name");
}
if (role != ARG_ROLE_POSITIONAL && !short_name && !long_name) {- In
ArgParse.c:442:
}
if (role != ARG_ROLE_POSITIONAL && !short_name && !long_name) {
LOG_FATAL("arg_register: option needs at least one of short/long name");
}- In
Page.c:53:
static void page_validate_self_structural(const PageAllocator *pg) {
if (!pg->base.allocate || !pg->base.resize || !pg->base.remap || !pg->base.deallocate) {
LOG_FATAL("PageAllocator: vtable function pointer is NULL");
}
if (pg->base.alignment == 0 || (pg->base.alignment & (pg->base.alignment - 1)) != 0) {- In
Page.c:56:
}
if (pg->base.alignment == 0 || (pg->base.alignment & (pg->base.alignment - 1)) != 0) {
LOG_FATAL("PageAllocator: alignment {} is not a positive power of two", (u64)pg->base.alignment);
}
if (pg->len > pg->cap) {- In
Page.c:59:
}
if (pg->len > pg->cap) {
LOG_FATAL("PageAllocator: len {} exceeds cap {}", (u64)pg->len, (u64)pg->cap);
}
if ((pg->entries == NULL) != (pg->cap == 0)) {- In
Page.c:62:
}
if ((pg->entries == NULL) != (pg->cap == 0)) {
LOG_FATAL("PageAllocator: entries / cap mismatch (entries={x}, cap={})", (u64)pg->entries, (u64)pg->cap);
}
if (pg->len > 0 && !pg->entries) {- In
Page.c:65:
}
if (pg->len > 0 && !pg->entries) {
LOG_FATAL("PageAllocator: len {} with NULL entries", (u64)pg->len);
}
if ((pg->entries == NULL) != (pg->entries_bytes == 0)) {- In
Page.c:68:
}
if ((pg->entries == NULL) != (pg->entries_bytes == 0)) {
LOG_FATAL("PageAllocator: entries / entries_bytes mismatch");
}
if (pg->entries && pg->entries_bytes < (size)pg->cap * sizeof(PageEntry)) {- In
Page.c:71:
}
if (pg->entries && pg->entries_bytes < (size)pg->cap * sizeof(PageEntry)) {
LOG_FATAL(
"PageAllocator: entries_bytes {} too small for cap {} (need {})",
(u64)pg->entries_bytes,- In
Page.c:85:
// Same invariants for the retention table.
if (pg->free_len > pg->free_cap) {
LOG_FATAL("PageAllocator: free_len {} exceeds free_cap {}", (u64)pg->free_len, (u64)pg->free_cap);
}
if ((pg->free_entries == NULL) != (pg->free_cap == 0)) {- In
Page.c:88:
}
if ((pg->free_entries == NULL) != (pg->free_cap == 0)) {
LOG_FATAL(
"PageAllocator: free_entries / free_cap mismatch ({x} / {})",
(u64)pg->free_entries,- In
Page.c:95:
}
if (pg->free_len > 0 && !pg->free_entries) {
LOG_FATAL("PageAllocator: free_len {} with NULL free_entries", (u64)pg->free_len);
}
if ((pg->free_entries == NULL) != (pg->free_entries_bytes == 0)) {- In
Page.c:98:
}
if ((pg->free_entries == NULL) != (pg->free_entries_bytes == 0)) {
LOG_FATAL("PageAllocator: free_entries / free_entries_bytes mismatch");
}
if (pg->free_entries) {- In
Page.c:107:
static void page_validate_self(const PageAllocator *pg) {
if (!pg) {
LOG_FATAL("PageAllocator: NULL self");
}
if (!MAGIC_MATCHES(pg->base.__magic, PAGE_ALLOCATOR_MAGIC)) {- In
Page.c:110:
}
if (!MAGIC_MATCHES(pg->base.__magic, PAGE_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to page_allocator_* is not a PageAllocator");
}
if (!(pg->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Page.c:442:
u32 idx = page_find_idx_sorted(self->entries, self->len, ptr);
if (idx == (u32)-1) {
LOG_FATAL("page_remap: foreign or already-freed ptr {x}", (u64)ptr);
return NULL;
}- In
Page.c:481:
// fast alloc-side exact-match lookup), so a ptr-keyed bsearch
// isn't available to disambiguate.
LOG_FATAL("page_free: foreign or already-freed ptr {x}", (u64)ptr);
return 0;
}- In
Budget.c:42:
static void budget_validate_self_structural(const BudgetAllocator *self) {
if (!self->base.allocate || !self->base.resize || !self->base.remap || !self->base.deallocate) {
LOG_FATAL("BudgetAllocator: vtable function pointer is NULL");
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {- In
Budget.c:45:
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {
LOG_FATAL("BudgetAllocator: alignment {} is not a positive power of two", (u64)self->base.alignment);
}
if (!self->buf || self->buf_bytes == 0) {- In
Budget.c:48:
}
if (!self->buf || self->buf_bytes == 0) {
LOG_FATAL("BudgetAllocator: NULL or zero-byte backing buffer");
}
if (!self->bitmap || self->bitmap_words == 0) {- In
Budget.c:51:
}
if (!self->bitmap || self->bitmap_words == 0) {
LOG_FATAL("BudgetAllocator: NULL or zero-word bitmap");
}
if (!self->slots || self->slot_count == 0) {- In
Budget.c:54:
}
if (!self->slots || self->slot_count == 0) {
LOG_FATAL("BudgetAllocator: NULL or zero-count slot region");
}
if (self->slot_size == 0) {- In
Budget.c:57:
}
if (self->slot_size == 0) {
LOG_FATAL("BudgetAllocator: slot_size is 0");
}
// Bitmap covers at least slot_count bits.
- In
Budget.c:61:
// Bitmap covers at least slot_count bits.
if ((u64)self->bitmap_words * 64u < (u64)self->slot_count) {
LOG_FATAL(
"BudgetAllocator: bitmap_words {} too small for slot_count {} (need {})",
(u64)self->bitmap_words,- In
Budget.c:71:
const u8 *buf_end = self->buf + self->buf_bytes;
if ((const u8 *)self->bitmap < self->buf || (const u8 *)self->bitmap >= buf_end) {
LOG_FATAL("BudgetAllocator: bitmap pointer outside buf region");
}
if (self->slots < self->buf || self->slots > buf_end) {- In
Budget.c:74:
}
if (self->slots < self->buf || self->slots > buf_end) {
LOG_FATAL("BudgetAllocator: slots pointer outside buf region");
}
if ((u64)self->slot_count * (u64)self->slot_size > (u64)(buf_end - self->slots)) {- In
Budget.c:77:
}
if ((u64)self->slot_count * (u64)self->slot_size > (u64)(buf_end - self->slots)) {
LOG_FATAL(
"BudgetAllocator: slots region overruns buf (need {} bytes, have {})",
(u64)self->slot_count * (u64)self->slot_size,- In
Budget.c:85:
// Bitmap region must precede the slot region (init lays them out that way).
if ((const u8 *)self->bitmap >= self->slots) {
LOG_FATAL("BudgetAllocator: bitmap region must precede slot region");
}
}- In
Budget.c:91:
static void budget_validate_self(const BudgetAllocator *self) {
if (!self) {
LOG_FATAL("BudgetAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, BUDGET_ALLOCATOR_MAGIC)) {- In
Budget.c:94:
}
if (!MAGIC_MATCHES(self->base.__magic, BUDGET_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to budget_allocator_* is not a BudgetAllocator");
}
if (!(self->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Budget.c:148:
u32 b = (u32)((u64)idx & 63u);
if (self->bitmap[w] & ((u64)1 << b)) {
LOG_FATAL("BudgetAllocator bitmap corruption: idx {} bit unexpectedly set", (u64)idx);
}
self->bitmap[w] |= ((u64)1 << b);- In
Budget.c:216:
if (p < self->slots || p >= end) {
LOG_FATAL("budget_free: foreign ptr {x} not in slot region", (u64)p);
return 0;
}- In
Budget.c:221:
size off = (size)(p - self->slots);
if (off % self->slot_size != 0) {
LOG_FATAL("budget_free: misaligned ptr {x} (slot size {})", (u64)p, (u64)self->slot_size);
return 0;
}- In
Budget.c:228:
u32 b = (u32)(idx & 63u);
if (!(self->bitmap[w] & ((u64)1 << b))) {
LOG_FATAL("budget_free: double-free of {x} (idx {})", (u64)p, (u64)idx);
return 0;
}- In
Heap.c:134:
static void heap_validate_self_structural(const HeapAllocator *h) {
if (!h->base.allocate || !h->base.resize || !h->base.remap || !h->base.deallocate) {
LOG_FATAL("HeapAllocator: vtable function pointer is NULL");
}
if (h->base.alignment == 0 || (h->base.alignment & (h->base.alignment - 1)) != 0) {- In
Heap.c:137:
}
if (h->base.alignment == 0 || (h->base.alignment & (h->base.alignment - 1)) != 0) {
LOG_FATAL("HeapAllocator: alignment {} is not a positive power of two", (u64)h->base.alignment);
}
if (h->pages_count > h->pages_cap) {- In
Heap.c:140:
}
if (h->pages_count > h->pages_cap) {
LOG_FATAL("HeapAllocator: pages_count {} exceeds pages_cap {}", (u64)h->pages_count, (u64)h->pages_cap);
}
if ((h->pages == NULL) != (h->pages_cap == 0)) {- In
Heap.c:143:
}
if ((h->pages == NULL) != (h->pages_cap == 0)) {
LOG_FATAL("HeapAllocator: pages / pages_cap mismatch ({x} / {})", (u64)h->pages, (u64)h->pages_cap);
}
if (h->pages_cap != 0 && (h->pages_cap & (h->pages_cap - 1)) != 0) {- In
Heap.c:146:
}
if (h->pages_cap != 0 && (h->pages_cap & (h->pages_cap - 1)) != 0) {
LOG_FATAL("HeapAllocator: pages_cap {} is not a power of two", (u64)h->pages_cap);
}
if (h->xl_in_use_len > h->xl_in_use_cap) {- In
Heap.c:149:
}
if (h->xl_in_use_len > h->xl_in_use_cap) {
LOG_FATAL(
"HeapAllocator: xl_in_use_len {} exceeds xl_in_use_cap {}",
(u64)h->xl_in_use_len,- In
Heap.c:156:
}
if ((h->xl_in_use == NULL) != (h->xl_in_use_cap == 0)) {
LOG_FATAL(
"HeapAllocator: xl_in_use / xl_in_use_cap mismatch ({x} / {})",
(u64)h->xl_in_use,- In
Heap.c:163:
}
if (h->xl_freed_len > h->xl_freed_cap) {
LOG_FATAL("HeapAllocator: xl_freed_len {} exceeds xl_freed_cap {}", (u64)h->xl_freed_len, (u64)h->xl_freed_cap);
}
if ((h->xl_freed == NULL) != (h->xl_freed_cap == 0)) {- In
Heap.c:166:
}
if ((h->xl_freed == NULL) != (h->xl_freed_cap == 0)) {
LOG_FATAL("HeapAllocator: xl_freed / xl_freed_cap mismatch ({x} / {})", (u64)h->xl_freed, (u64)h->xl_freed_cap);
}
if (h->pages) {- In
Heap.c:190:
static FORCE_INLINE void heap_validate_self(const HeapAllocator *h) {
if (!h) {
LOG_FATAL("HeapAllocator: NULL self");
}
if (!MAGIC_MATCHES(h->base.__magic, HEAP_ALLOCATOR_MAGIC)) {- In
Heap.c:193:
}
if (!MAGIC_MATCHES(h->base.__magic, HEAP_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to heap_allocator_* is not a HeapAllocator");
}
if (!(h->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Heap.c:649:
}
// Unreachable: caller verified there's a free slot.
LOG_FATAL("HeapAllocator: take_slot on a full page (class {}, page {x})", (u64)cls, (u64)d->page);
return NULL;
}- In
Heap.c:875:
if (off >= (u64)slot_size * heap_class_slots[cls]) {
LOG_FATAL("heap_free: ptr {x} past slot region (class size {})", (u64)ptr, (u64)slot_size);
return;
}- In
Heap.c:879:
}
if (off % slot_size != 0u) {
LOG_FATAL("heap_free: misaligned ptr {x} for slot size {}", (u64)ptr, (u64)slot_size);
return;
}- In
Heap.c:887:
u64 mask = (u64)1 << bit;
if (!(d->bitmap[w] & mask)) {
LOG_FATAL("heap_free: double-free of {x} (class size {}, slot {})", (u64)ptr, (u64)slot_size, (u64)slot_idx);
return;
}- In
Heap.c:954:
size cur = heap_recover_size(self, ptr, &idx, &is_xl);
if (!cur) {
LOG_FATAL("heap_remap: foreign or already-freed ptr {x}", (u64)ptr);
return NULL;
}- In
Heap.c:1060:
size cur = heap_recover_size(self, ptr, &idx, &is_xl);
if (!cur) {
LOG_FATAL("heap_free: foreign or already-freed ptr {x}", (u64)ptr);
return 0;
}- In
Debug.c:130:
static void debug_validate_self_structural(const DebugAllocator *self) {
if (!self->base.allocate || !self->base.resize || !self->base.remap || !self->base.deallocate) {
LOG_FATAL("DebugAllocator: vtable function pointer is NULL");
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {- In
Debug.c:133:
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {
LOG_FATAL("DebugAllocator: alignment {} is not a positive power of two", (u64)self->base.alignment);
}
// Embedded backing allocators must themselves be sane. We don't
- In
Debug.c:141:
// masks the memo bit so neither memoized state breaks the check.
if (!MAGIC_MATCHES(self->heap.base.__magic, HEAP_ALLOCATOR_MAGIC)) {
LOG_FATAL("DebugAllocator: embedded heap has bad magic");
}
if (!MAGIC_MATCHES(self->meta.base.__magic, HEAP_ALLOCATOR_MAGIC)) {- In
Debug.c:144:
}
if (!MAGIC_MATCHES(self->meta.base.__magic, HEAP_ALLOCATOR_MAGIC)) {
LOG_FATAL("DebugAllocator: embedded meta has bad magic");
}
if (!MAGIC_MATCHES(self->page.base.__magic, PAGE_ALLOCATOR_MAGIC)) {- In
Debug.c:147:
}
if (!MAGIC_MATCHES(self->page.base.__magic, PAGE_ALLOCATOR_MAGIC)) {
LOG_FATAL("DebugAllocator: embedded page has bad magic");
}
if (!MAGIC_MATCHES(self->live.__magic, MAP_MAGIC)) {- In
Debug.c:150:
}
if (!MAGIC_MATCHES(self->live.__magic, MAP_MAGIC)) {
LOG_FATAL("DebugAllocator: live map has bad magic");
}
if (!MAGIC_MATCHES(self->freed.__magic, VEC_MAGIC)) {- In
Debug.c:153:
}
if (!MAGIC_MATCHES(self->freed.__magic, VEC_MAGIC)) {
LOG_FATAL("DebugAllocator: freed vec has bad magic");
}
// bytes_in_use must be consistent with live: if live is non-empty
- In
Debug.c:159:
// every byte has been returned.
if (MapPairCount(&self->live) == 0 && self->bytes_in_use != 0) {
LOG_FATAL("DebugAllocator: bytes_in_use {} with no live records", (u64)self->bytes_in_use);
}
u64 cur_tid = debug_current_tid();- In
Debug.c:163:
u64 cur_tid = debug_current_tid();
if (self->creator_tid != cur_tid) {
LOG_FATAL(
"DebugAllocator: cross-thread use detected (created on {x}, called from {x}). "
"Each thread must use its own DebugAllocator instance.",- In
Debug.c:174:
static void debug_validate_self(const DebugAllocator *self) {
if (!self) {
LOG_FATAL("DebugAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, DEBUG_ALLOCATOR_MAGIC)) {- In
Debug.c:177:
}
if (!MAGIC_MATCHES(self->base.__magic, DEBUG_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to debug_allocator_* is not a DebugAllocator");
}
// Lazy-bind the embedded Map/Vec's `.allocator` pointer. The
- In
Debug.c:329:
debug_emit_trace(fe->alloc_trace, fe->alloc_trace_n, "alloc", ALLOCATOR_OF(&self->meta));
debug_emit_trace(fe->free_trace, fe->free_trace_n, "first-free", ALLOCATOR_OF(&self->meta));
LOG_FATAL("DebugAllocator: double-free of {x}", (u64)ptr);
return 0;
}- In
Debug.c:461:
u64 cur_tid = debug_current_tid();
if (self->creator_tid != cur_tid) {
LOG_FATAL(
"DebugAllocator: Deinit called from a different thread (created on {x}, called from {x}).",
self->creator_tid,- In
Arena.c:28:
static void arena_validate_self_structural(const ArenaAllocator *self) {
if (!self->base.allocate || !self->base.resize || !self->base.remap || !self->base.deallocate) {
LOG_FATAL("ArenaAllocator: vtable function pointer is NULL");
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {- In
Arena.c:31:
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {
LOG_FATAL("ArenaAllocator: alignment {} is not a positive power of two", (u64)self->base.alignment);
}
if ((self->head == NULL) != (self->tail == NULL)) {- In
Arena.c:34:
}
if ((self->head == NULL) != (self->tail == NULL)) {
LOG_FATAL("ArenaAllocator: head/tail mismatch ({x} / {x})", (u64)self->head, (u64)self->tail);
}
if ((self->last_ptr == NULL) != (self->last_size == 0)) {- In
Arena.c:37:
}
if ((self->last_ptr == NULL) != (self->last_size == 0)) {
LOG_FATAL("ArenaAllocator: last_ptr/last_size mismatch ({x} / {})", (u64)self->last_ptr, (u64)self->last_size);
}
if (self->last_ptr && !self->head) {- In
Arena.c:40:
}
if (self->last_ptr && !self->head) {
LOG_FATAL("ArenaAllocator: last_ptr is set but chunk list is empty");
}
}- In
Arena.c:46:
static void arena_validate_self(const ArenaAllocator *self) {
if (!self) {
LOG_FATAL("ArenaAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, ARENA_ALLOCATOR_MAGIC)) {- In
Arena.c:49:
}
if (!MAGIC_MATCHES(self->base.__magic, ARENA_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to arena_allocator_* is not an ArenaAllocator");
}
if (!(self->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Arena.c:237:
// below carry the distinction.
if (!arena_owns_pointer(self, ptr)) {
LOG_FATAL("arena_remap: foreign ptr {x} (not in any chunk)", (u64)ptr);
return NULL;
}- In
Arena.c:241:
}
if (self->last_ptr != ptr) {
LOG_FATAL(
"arena_remap: ptr {x} is not the most recent bump; bump allocators "
"cannot remap mid-stream allocations. Use HeapAllocator for "- In
Arena.c:301:
// verify ownership -- a foreign pointer is a caller bug and aborts.
if (!arena_owns_pointer(self, ptr)) {
LOG_FATAL("arena_free: foreign ptr {x} (not in any chunk)", (u64)ptr);
return 0;
}- In
Slab.c:36:
static void slab_validate_self_structural(const SlabAllocator *self) {
if (!self->base.allocate || !self->base.resize || !self->base.remap || !self->base.deallocate) {
LOG_FATAL("SlabAllocator: vtable function pointer is NULL");
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {- In
Slab.c:39:
}
if (self->base.alignment == 0 || (self->base.alignment & (self->base.alignment - 1)) != 0) {
LOG_FATAL("SlabAllocator: alignment {} is not a positive power of two", (u64)self->base.alignment);
}
if (self->slot_size == 0) {- In
Slab.c:42:
}
if (self->slot_size == 0) {
LOG_FATAL("SlabAllocator: slot_size is 0");
}
if ((self->slot_size & (self->slot_size - 1)) != 0) {- In
Slab.c:45:
}
if ((self->slot_size & (self->slot_size - 1)) != 0) {
LOG_FATAL("SlabAllocator: slot_size {} is not a power of two", (u64)self->slot_size);
}
if (self->slot_size < 16) {- In
Slab.c:48:
}
if (self->slot_size < 16) {
LOG_FATAL("SlabAllocator: slot_size {} below 16-byte minimum", (u64)self->slot_size);
}
if (self->slot_size_shift == 0 || ((size)1 << self->slot_size_shift) != self->slot_size) {- In
Slab.c:51:
}
if (self->slot_size_shift == 0 || ((size)1 << self->slot_size_shift) != self->slot_size) {
LOG_FATAL(
"SlabAllocator: slot_size_shift {} disagrees with slot_size {}",
(u64)self->slot_size_shift,- In
Slab.c:58:
}
if ((self->slabs == NULL) != (self->slabs_cap == 0)) {
LOG_FATAL("SlabAllocator: slabs / slabs_cap mismatch ({x} / {})", (u64)self->slabs, (u64)self->slabs_cap);
}
if ((self->bitmaps == NULL) != (self->slabs_cap == 0)) {- In
Slab.c:61:
}
if ((self->bitmaps == NULL) != (self->slabs_cap == 0)) {
LOG_FATAL("SlabAllocator: bitmaps / slabs_cap mismatch ({x} / {})", (u64)self->bitmaps, (u64)self->slabs_cap);
}
if (self->slabs_len > self->slabs_cap) {- In
Slab.c:64:
}
if (self->slabs_len > self->slabs_cap) {
LOG_FATAL("SlabAllocator: slabs_len {} exceeds slabs_cap {}", (u64)self->slabs_len, (u64)self->slabs_cap);
}
}- In
Slab.c:70:
static FORCE_INLINE void slab_validate_self(const SlabAllocator *self) {
if (!self) {
LOG_FATAL("SlabAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, SLAB_ALLOCATOR_MAGIC)) {- In
Slab.c:73:
}
if (!MAGIC_MATCHES(self->base.__magic, SLAB_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to slab_allocator_* is not a SlabAllocator");
}
if (!(self->base.__magic & MAGIC_VALIDATED_BIT)) {- In
Slab.c:95:
size page_size = os_page_size();
if (slab->slot_size < 16u) {
LOG_FATAL("SlabAllocator: slot_size {} below 16-byte minimum", (u64)slab->slot_size);
}
if (slab->slot_size > page_size) {- In
Slab.c:98:
}
if (slab->slot_size > page_size) {
LOG_FATAL("SlabAllocator: slot_size {} exceeds page size {}", (u64)slab->slot_size, (u64)page_size);
}
if ((slab->slot_size & (slab->slot_size - 1)) != 0) {- In
Slab.c:101:
}
if ((slab->slot_size & (slab->slot_size - 1)) != 0) {
LOG_FATAL("SlabAllocator: slot_size {} is not a power of two", (u64)slab->slot_size);
}
if (slab->slot_size_shift == 0 || ((size)1u << slab->slot_size_shift) != slab->slot_size) {- In
Slab.c:104:
}
if (slab->slot_size_shift == 0 || ((size)1u << slab->slot_size_shift) != slab->slot_size) {
LOG_FATAL(
"SlabAllocator: slot_size_shift {} disagrees with slot_size {}",
(u64)slab->slot_size_shift,- In
Slab.c:119:
// 16320 slots per slab; way past anything sensible for our
// slot-size range.
LOG_FATAL("SlabAllocator: bitmap words per slab {} exceeds u8 range", (u64)words);
}
slab->bitmap_words_per_slab = (u8)words;- In
Slab.c:393:
u32 idx = slab_find_by_page(self, page_base);
if (idx == (u32)-1) {
LOG_FATAL("slab_free: foreign ptr {x} not in any slab", (u64)ptr);
return 0;
}- In
Slab.c:403:
// round it down and clear the wrong bit. Catch this explicitly.
if ((offset & (self->slot_size - 1u)) != 0u) {
LOG_FATAL("slab_free: misaligned ptr {x} (slot size {})", (u64)ptr, (u64)self->slot_size);
return 0;
}- In
Slab.c:412:
u64 mask = (u64)1 << bit;
if (!(bm[w] & mask)) {
LOG_FATAL("slab_free: double-free of {x} (slot {})", (u64)ptr, (u64)slot_idx);
return 0;
}- In
BitVec.c:225:
ValidateBitVec(bv);
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
BitVec.c:259:
ValidateBitVec(bitvec);
if (idx >= bitvec->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
}
u64 byte_idx = BIT_INDEX(idx);- In
BitVec.c:270:
ValidateBitVec(bitvec);
if (idx >= bitvec->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
}
u64 byte_idx = BIT_INDEX(idx);- In
BitVec.c:285:
ValidateBitVec(bitvec);
if (idx >= bitvec->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
}
u64 byte_idx = BIT_INDEX(idx);- In
BitVec.c:312:
ValidateBitVec(bitvec);
if (bitvec->length == 0) {
LOG_FATAL("Cannot pop from empty bitvector");
}
bool value = BitVecGet(bitvec, bitvec->length - 1);- In
BitVec.c:322:
ValidateBitVec(bitvec);
if (idx > bitvec->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
}
if (!BitVecPush(bitvec, false)) {- In
BitVec.c:340:
ValidateBitVec(bv);
if (idx > bv->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
}
if (count == 0) {- In
BitVec.c:368:
ValidateBitVec(other);
if (idx > bv->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
}
if (other->length == 0) {- In
BitVec.c:396:
ValidateBitVec(bv);
if (idx > bv->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
}
if (pattern_bits == 0 || pattern_bits > 8) {- In
BitVec.c:426:
ValidateBitVec(bv);
if (idx >= bv->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
}- In
BitVec.c:443:
ValidateBitVec(bv);
if (idx >= bv->length) {
LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
}
if (count == 0) {- In
BitVec.c:612:
if (start1 + len > bv1->length) {
LOG_FATAL("Range [{}:{}] exceeds bitvector1 length {}", start1, LVAL(start1 + len - 1), bv1->length);
}
if (start2 + len > bv2->length) {- In
BitVec.c:615:
}
if (start2 + len > bv2->length) {
LOG_FATAL("Range [{}:{}] exceeds bitvector2 length {}", start2, LVAL(start2 + len - 1), bv2->length);
}- In
BitVec.c:682:
if (start1 + len > bv1->length) {
LOG_FATAL("Range [{}:{}] exceeds bitvector1 length {}", start1, LVAL(start1 + len - 1), bv1->length);
}
if (start2 + len > bv2->length) {- In
BitVec.c:685:
}
if (start2 + len > bv2->length) {
LOG_FATAL("Range [{}:{}] exceeds bitvector2 length {}", start2, LVAL(start2 + len - 1), bv2->length);
}- In
BitVec.c:835:
ValidateBitVec(bv);
if (!out) {
LOG_FATAL("out is NULL");
}- In
BitVec.c:871:
static bool bitvec_try_from_str_impl(BitVec *out, Zstr str, u64 str_len, Allocator *alloc) {
if (!str) {
LOG_FATAL("str is NULL");
}
if (!out) {- In
BitVec.c:874:
}
if (!out) {
LOG_FATAL("out is NULL");
}- In
BitVec.c:907:
bool bitvec_try_from_str_zstr(BitVec *out, Zstr str, Allocator *alloc) {
if (!str) {
LOG_FATAL("str is NULL");
}
return bitvec_try_from_str_impl(out, str, (u64)ZstrLen(str), alloc);- In
BitVec.c:914:
bool bitvec_try_from_str_str(BitVec *out, const Str *str, Allocator *alloc) {
if (!str) {
LOG_FATAL("str is NULL");
}
return bitvec_try_from_str_impl(out, str->data, str->length, alloc);- In
BitVec.c:942:
ValidateBitVec(bv);
if (!bytes) {
LOG_FATAL("bytes is NULL");
}
if (max_len == 0) {- In
BitVec.c:945:
}
if (max_len == 0) {
LOG_FATAL("max_len is 0");
}
if (bv->length == 0) {- In
BitVec.c:970:
bool bitvec_try_from_bytes(BitVec *out, const u8 *bytes, u64 bit_len, Allocator *alloc) {
if (!bytes) {
LOG_FATAL("bytes is NULL");
}
if (!out) {- In
BitVec.c:973:
}
if (!out) {
LOG_FATAL("out is NULL");
}- In
BitVec.c:1028:
bool bitvec_try_from_integer(BitVec *out, u64 value, u64 bits, Allocator *alloc) {
if (!out) {
LOG_FATAL("out is NULL");
}- In
BitVec.c:1289:
if (!results || max_results == 0) {
LOG_FATAL("results is NULL or max_results is 0");
}- In
BitVec.c:1313:
if (!out || !out->allocator) {
LOG_FATAL("output BitVecMatchIndices is NULL or uninitialized");
}- In
BitVec.c:1332:
ValidateBitVec(bv);
if (!runs || !values || max_runs == 0) {
LOG_FATAL("invalid arguments");
}- In
BitVec.c:1375:
ValidateBitVec(bv);
if (!out || !out->allocator) {
LOG_FATAL("output BitVecRuns is NULL or uninitialized");
}- In
BitVec.c:1488:
ValidateBitVec(bv2);
if (!out) {
LOG_FATAL("out is NULL");
}- In
BitVec.c:1852:
ValidateBitVec(bv);
if (!pattern) {
LOG_FATAL("pattern is NULL");
}- In
BitVec.c:1873:
ValidateBitVec(bv);
if (!pattern) {
LOG_FATAL("pattern is NULL");
}- In
BitVec.c:1890:
ValidateBitVec(bv);
if (!patterns) {
LOG_FATAL("invalid BitVecs object provided");
}- In
BitVec.c:1905:
ValidateBitVec(bv);
if (!patterns) {
LOG_FATAL("invalid arguments");
}- In
BitVec.c:1921:
static void validate_bitvec_structural(const BitVec *bv) {
if (bv->length > bv->capacity) {
LOG_FATAL("Invalid bitvec object: length > capacity.");
}
if (bv->length > 0 && !bv->data) {- In
BitVec.c:1924:
}
if (bv->length > 0 && !bv->data) {
LOG_FATAL("Invalid bitvec object: length > 0 but data is NULL.");
}
if (bv->capacity > 0 && bv->byte_size * 8 < bv->capacity) {- In
BitVec.c:1927:
}
if (bv->capacity > 0 && bv->byte_size * 8 < bv->capacity) {
LOG_FATAL("Invalid bitvec object: byte_size too small for capacity.");
}
if (bv->data) {- In
BitVec.c:1938:
void ValidateBitVec(const BitVec *bv) {
if (!bv) {
LOG_FATAL("Invalid bitvec object: NULL.");
}
if (!MAGIC_MATCHES(bv->__magic, BITVEC_MAGIC)) {- In
BitVec.c:1941:
}
if (!MAGIC_MATCHES(bv->__magic, BITVEC_MAGIC)) {
LOG_FATAL("Invalid bitvec. Either uninitialized or corrupted!");
}
if (!(bv->__magic & MAGIC_VALIDATED_BIT)) {- In
Graph.c:28:
if (!alignment) {
LOG_FATAL("Invalid graph allocator alignment. Did you initialize the graph before use?");
}- In
Graph.c:32:
if ((alignment > 1) && !graph_alignment_is_pow2(alignment)) {
LOG_FATAL("Graph allocator alignment must be 1 or a power of two");
}
}- In
Graph.c:38:
static void graph_validate_slot_limit(const GenericGraph *graph) {
if (VecLen(&graph->slots) > (u64)UINT32_MAX) {
LOG_FATAL("Graph exceeded maximum supported slot count");
}
}- In
Graph.c:52:
static void graph_validate_node_index_raw(const GenericGraph *graph, u32 index) {
if ((u64)index >= VecLen(&graph->slots)) {
LOG_FATAL("graph node id out of bounds");
}
}- In
Graph.c:73:
if (!generation) {
LOG_FATAL("graph node id has invalid generation");
}- In
Graph.c:80:
if (!graph_slot_is_occupied(slot)) {
LOG_FATAL("graph node id refers to a free slot");
}- In
Graph.c:84:
if (slot->generation != generation) {
LOG_FATAL("graph node id is stale");
}
}- In
Graph.c:103:
graph = GENERIC_GRAPH(node._graph_);
if (!graph) {
LOG_FATAL("invalid graph node handle");
}- In
Graph.c:149:
static void graph_ensure_slot_generation_available(GenericGraphSlot *slot) {
if (slot->generation == UINT32_MAX) {
LOG_FATAL("graph slot generation exhausted");
}
}- In
Graph.c:181:
1
)) {
LOG_FATAL("Graph failed to record a reusable slot index");
}
}- In
Graph.c:189:
if (!VecLen(&graph->free_indices)) {
LOG_FATAL("expected at least one free graph slot");
}- In
Graph.c:249:
in_idx = graph_find_neighbor_index(in_neighbors, from);
if (in_idx == SIZE_MAX) {
LOG_FATAL("Graph reverse adjacency is inconsistent during edge removal");
}- In
Graph.c:275:
} else {
if (!graph_remove_edge_now(graph, from, neighbor_id)) {
LOG_FATAL("Graph failed to remove marked outgoing edge");
}
removed += 1;- In
Graph.c:291:
GraphNodeId to = VecLast(neighbors);
if (!graph_remove_edge_now(graph, from, to)) {
LOG_FATAL("Graph failed to remove outgoing edge during node deletion");
}
removed += 1;- In
Graph.c:308:
if (!graph) {
LOG_FATAL("Expected a valid Graph pointer");
}- In
Graph.c:312:
if (!MAGIC_MATCHES(graph->__magic, GRAPH_MAGIC)) {
LOG_FATAL("Graph is uninitialized or corrupted");
}- In
Graph.c:329:
// dereferencing the method table.
if (!graph->allocator) {
LOG_FATAL("Graph allocator pointer is NULL");
}- In
Graph.c:334:
if (!graph->allocator->allocate || !graph->allocator->resize || !graph->allocator->remap ||
!graph->allocator->deallocate) {
LOG_FATAL("Graph allocator is not fully configured");
}- In
Graph.c:344:
if (graph->live_count > VecLen(&graph->slots)) {
LOG_FATAL("Graph live node count exceeds slot count");
}- In
Graph.c:348:
if (graph->pending_delete_count > graph->live_count) {
LOG_FATAL("Graph pending delete count exceeds live node count");
}- In
Graph.c:352:
if ((graph->live_count + VecLen(&graph->free_indices)) != VecLen(&graph->slots)) {
LOG_FATAL("Graph slot accounting is inconsistent");
}- In
Graph.c:365:
if (graph_slot_is_occupied(slot)) {
if (!slot->data) {
LOG_FATAL("Occupied graph slot has NULL payload");
}- In
Graph.c:369:
if (!slot->generation) {
LOG_FATAL("Occupied graph slot has invalid generation");
}- In
Graph.c:384:
target_slot = graph_require_live_slot_const(graph, neighbor_id);
if (!graph_neighbors_contains(&target_slot->in_neighbors, self_id)) {
LOG_FATAL("Graph reverse adjacency is missing predecessor entry");
}
}- In
Graph.c:395:
source_slot = graph_require_live_slot_const(graph, predecessor_id);
if (!graph_neighbors_contains(&source_slot->out_neighbors, self_id)) {
LOG_FATAL("Graph reverse adjacency is missing outgoing edge");
}
}- In
Graph.c:400:
} else {
if (slot->data) {
LOG_FATAL("Free graph slot retains payload pointer");
}- In
Graph.c:404:
if (slot->visit_count != 0) {
LOG_FATAL("Free graph slot retains visit count");
}- In
Graph.c:408:
if (VecLen(&slot->out_neighbors) != 0) {
LOG_FATAL("Free graph slot retains outgoing edges");
}- In
Graph.c:412:
if (VecLen(&slot->in_neighbors) != 0) {
LOG_FATAL("Free graph slot retains incoming edges");
}
}- In
Graph.c:420:
u32 index = VecAt(&graph->free_indices, free_index_i);
if ((u64)index >= VecLen(&graph->slots)) {
LOG_FATAL("Graph free slot index out of bounds");
}- In
Graph.c:424:
if (graph_slot_is_occupied(VecPtrAt((GraphSlots *)&graph->slots, index))) {
LOG_FATAL("Graph free index points to an occupied slot");
}
}- In
Graph.c:438:
if (!graph_neighbors_contains(neighbors, pending->to)) {
LOG_FATAL("Graph pending edge removal refers to a missing edge");
}
}- In
Graph.c:443:
if (graph->live_count != live_count) {
LOG_FATAL("Graph live node count is inconsistent");
}- In
Graph.c:447:
if ((graph->edge_count != out_edge_count) || (graph->edge_count != in_edge_count)) {
LOG_FATAL("Graph edge count is inconsistent");
}- In
Graph.c:451:
if (graph->pending_delete_count != marked_count) {
LOG_FATAL("Graph pending delete count is inconsistent");
}
// Mark verified.
- In
Graph.c:529:
if (!graph || !item_data || !item_size) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:538:
slot_ptr = graph_slot_ptr_raw(graph, slot_index);
if (graph_slot_is_occupied(slot_ptr)) {
LOG_FATAL("graph free slot unexpectedly occupied");
}- In
Graph.c:612:
if (!graph || !item_data || !item_size) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:630:
if (!graph) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:665:
if (GENERIC_GRAPH(validated._graph_) != graph) {
LOG_FATAL("graph node handle does not belong to the provided graph");
}- In
Graph.c:695:
if (neighbor_idx >= VecLen(neighbors)) {
LOG_FATAL("graph neighbor index out of bounds");
}- In
Graph.c:709:
if (predecessor_idx >= VecLen(neighbors)) {
LOG_FATAL("graph predecessor index out of bounds");
}- In
Graph.c:773:
if (slot->visit_count == UINT64_MAX) {
LOG_FATAL("graph node visit count overflow");
}- In
Graph.c:939:
if (graph_slot_is_occupied(slot) && graph_slot_is_marked(slot)) {
if (VecLen(&slot->out_neighbors) || VecLen(&slot->in_neighbors)) {
LOG_FATAL("Graph marked node retained incident edges before release");
}
graph_release_slot(graph, slot, item_size);- In
Graph.c:966:
bool graph_node_iter_next(GenericGraphNodeIter *iter, GraphNode *out_node) {
if (!iter || !out_node) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:975:
ValidateGraph(iter->graph);
if (iter->expected_mutation_epoch != iter->graph->mutation_epoch) {
LOG_FATAL("graph structure changed during node iteration");
}- In
Graph.c:1011:
if (!iter || !out_node) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:1020:
ValidateGraph(iter->graph);
if (iter->expected_mutation_epoch != iter->graph->mutation_epoch) {
LOG_FATAL("graph structure changed during neighbor iteration");
}- In
Graph.c:1058:
if (!iter || !out_node) {
LOG_FATAL("invalid arguments");
}- In
Graph.c:1067:
ValidateGraph(iter->graph);
if (iter->expected_mutation_epoch != iter->graph->mutation_epoch) {
LOG_FATAL("graph structure changed during predecessor iteration");
}- In
List.c:14:
void deinit_list(GenericList *list, u64 item_size) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:31:
if (!list || !item_size || !item_data) {
LOG_FATAL("invalid arguments.");
}- In
List.c:37:
if (idx > list->length) {
LOG_FATAL("list index out of range.");
}- In
List.c:97:
void remove_range_list(GenericList *list, void *removed_data, u64 item_size, u64 start, u64 count) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:109:
// length would pass the bound check. Catch it first.
if (count > UINT64_MAX - start) {
LOG_FATAL("list remove range: start + count overflows u64");
}
if (start + count > list->length) {- In
List.c:112:
}
if (start + count > list->length) {
LOG_FATAL("List range out of bounds.");
}- In
List.c:179:
if (!list || !item_size || !comp) {
LOG_FATAL("invalid arguments.");
}- In
List.c:193:
// would write past the buffer.
if (item_size && item_count > UINT64_MAX / item_size) {
LOG_FATAL("list_sort: item_size * item_count overflows u64");
}
data = AllocatorAlloc(list->allocator, item_size * item_count, false);- In
List.c:221:
void swap_list(GenericList *list, u64 item_size, u64 idx1, u64 idx2) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:228:
GenericListNode *n1 = node_at_list(list, item_size, idx1);
if (!n1) {
LOG_FATAL("failed to get node at specified index");
}- In
List.c:233:
GenericListNode *n2 = node_at_list(list, item_size, idx2);
if (!n2) {
LOG_FATAL("failed to get node at specified index");
}- In
List.c:250:
void reverse_list(GenericList *list, u64 item_size) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:268:
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:278:
if (!arr) {
LOG_FATAL("invalid arguments.");
}- In
List.c:306:
if (!list1 || !item_size || !list2) {
LOG_FATAL("invalid arguments.");
}- In
List.c:313:
if (list1 == list2) {
LOG_FATAL("cannot merge list with itself.");
}- In
List.c:334:
void clear_list(GenericList *list, u64 item_size) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:345:
GenericListNode *node_at_list(GenericList *list, u64 item_size, u64 idx) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:351:
if (idx >= list->length) {
LOG_FATAL("list index out of range.");
}- In
List.c:364:
void *item_ptr_at_list(GenericList *list, u64 item_size, u64 idx) {
if (!list || !item_size) {
LOG_FATAL("invalid arguments.");
}- In
List.c:370:
if (idx >= list->length) {
LOG_FATAL("list index out of bounds.");
}- In
List.c:379:
size find_idx_list(GenericList *list, const void *item_data, u64 item_size, GenericCompare comp) {
if (!list || !item_data || !item_size || !comp) {
LOG_FATAL("invalid arguments.");
}- In
List.c:402:
static void validate_list_structural(const GenericList *l) {
if (!l->allocator) {
LOG_FATAL("List allocator pointer is NULL.");
}
if (!l->allocator->allocate || !l->allocator->resize || !l->allocator->remap || !l->allocator->deallocate) {- In
List.c:405:
}
if (!l->allocator->allocate || !l->allocator->resize || !l->allocator->remap || !l->allocator->deallocate) {
LOG_FATAL("Invalid list allocator.");
}
if (l->length == 0) {- In
List.c:409:
if (l->length == 0) {
if (l->head || l->tail) {
LOG_FATAL("Empty list must have NULL head and tail.");
}
} else {- In
List.c:413:
} else {
if (!l->head) {
LOG_FATAL("Non-empty list has NULL head.");
}
if (!l->tail) {- In
List.c:416:
}
if (!l->tail) {
LOG_FATAL("Non-empty list has NULL tail.");
}
if (l->head->prev) {- In
List.c:419:
}
if (l->head->prev) {
LOG_FATAL("List head must not have a previous node.");
}
if (l->tail->next) {- In
List.c:422:
}
if (l->tail->next) {
LOG_FATAL("List tail must not have a next node.");
}
}- In
List.c:429:
void validate_list(const GenericList *l) {
if (!l) {
LOG_FATAL("List pointer is NULL.");
}
if (!MAGIC_MATCHES(l->__magic, LIST_MAGIC)) {- In
List.c:432:
}
if (!MAGIC_MATCHES(l->__magic, LIST_MAGIC)) {
LOG_FATAL("Invalid list. Either not initialized or corrupted!");
}
if (!(l->__magic & MAGIC_VALIDATED_BIT)) {- In
List.c:443:
GenericListNode *get_node_relative_to_list_node(GenericListNode *node, i64 ridx) {
if (!node) {
LOG_FATAL("Invalid arguments");
}- In
List.c:469:
GenericListNode *get_node_random_access(GenericList *list, GenericListNode *node, u64 nidx, i64 ridx) {
if (!list || !node) {
LOG_FATAL("Invalid arguments");
}- In
List.c:473:
if (nidx >= list->length) {
LOG_FATAL("Node index exceeds list bounds");
}- In
List.c:477:
if ((ridx < 0 && (u64)(-ridx) > nidx) || (ridx > 0 && nidx + (u64)ridx >= list->length)) {
LOG_FATAL("Relative node index outside of list bounds");
}- In
List.c:519:
GenericListNode *get_node_for_list_iteration(GenericList *list, GenericListNode *node, u64 nidx, u64 target_idx) {
if (!list) {
LOG_FATAL("Invalid arguments");
}- In
List.c:525:
if (target_idx >= list->length) {
LOG_FATAL("Node index exceeds list bounds");
}- In
List.c:564:
if (!items) {
LOG_FATAL("Expected a valid pointer");
}- In
List.c:571:
// ownership had moved out of the range it can still see.
if (item_size && count > UINT64_MAX / item_size) {
LOG_FATAL("list_insert_range_l: item_size * count overflows u64");
}- In
List.c:583:
if (!items) {
LOG_FATAL("Expected a valid pointer");
}- In
Vec.c:56:
// real cause instead.
if (!vec->allocator) {
LOG_FATAL("vector not growable, no allocator assigned, probably stack inited");
}- In
Vec.c:106:
if (n > vec->capacity) {
if (!vec->allocator) {
LOG_FATAL("vector not growable, no allocator assigned, probably stack inited");
}
size old_capacity = (size)vec->capacity;- In
Vec.c:155:
// allocator to free into / shrink through.
if (!vec->allocator) {
LOG_FATAL("vector not growable, no allocator assigned, probably stack inited");
}- In
Vec.c:218:
if (idx > vec->length) {
LOG_FATAL("vector index out of bounds, insertion at index greater than length");
}
// Overflow check on length + count. A wrapped sum below capacity
- In
Vec.c:223:
// would skip the reserve and walk past the buffer.
if (count > (size)-1 - vec->length) {
LOG_FATAL("vector insert: length + count overflows size");
}- In
Vec.c:285:
if (idx > vec->length) {
LOG_FATAL("vector index out of bounds, insertion at index greater than length");
}
// Overflow check on length + count. Same shape as insert_range_into_vec.
- In
Vec.c:289:
// Overflow check on length + count. Same shape as insert_range_into_vec.
if (count > (size)-1 - vec->length) {
LOG_FATAL("vector insert (fast): length + count overflows size");
}- In
Vec.c:354:
// below length would pass the bound check. Catch it first.
if (count > (size)-1 - start) {
LOG_FATAL("vector remove range: start + count overflows size");
}
if (start + count > vec->length) {- In
Vec.c:357:
}
if (start + count > vec->length) {
LOG_FATAL("vector range out of bounds.");
}- In
Vec.c:399:
// below length would pass the bound check. Catch it first.
if (count > (size)-1 - start) {
LOG_FATAL("vector fast remove range: start + count overflows size");
}
if (start + count > vec->length) {- In
Vec.c:402:
}
if (start + count > vec->length) {
LOG_FATAL("vector range out of bounds.");
}- In
Vec.c:451:
if (vec_aligned_size(vec, item_size) != item_size) {
LOG_FATAL(
"QSort not implemented for vectors wherein the size of items don't "
"match their aligned size."- In
Vec.c:465:
if (idx1 >= vec->length || idx2 >= vec->length) {
LOG_FATAL("vector index out of bounds.");
}- In
Vec.c:498:
if (!item_data || !comp) {
LOG_FATAL("Invalid arguments.");
}- In
Vec.c:539:
static void validate_vec_structural(const GenericVec *v) {
if (v->length > v->capacity) {
LOG_FATAL("Invalid vec object.");
}
if (v->allocator &&- In
Vec.c:543:
if (v->allocator &&
(!v->allocator->allocate || !v->allocator->resize || !v->allocator->remap || !v->allocator->deallocate)) {
LOG_FATAL("Invalid vec allocator.");
}
if (v->data) {- In
Vec.c:552:
void validate_vec(const GenericVec *v) {
if (!v) {
LOG_FATAL("NULL vec object pointer.");
}
if (!MAGIC_MATCHES(v->__magic, VEC_MAGIC)) {- In
Vec.c:555:
}
if (!MAGIC_MATCHES(v->__magic, VEC_MAGIC)) {
LOG_FATAL("Invalid vec object. Either uninitialized or corrupted!");
}
if (!(v->__magic & MAGIC_VALIDATED_BIT)) {- In
Vec.c:587:
if (!items) {
LOG_FATAL("Expected a valid pointer");
}- In
Vec.c:598:
bool vec_insert_range_r(GenericVec *vec, const void *items, size item_size, size idx, size count, bool preserve_order) {
if (!items) {
LOG_FATAL("Expected a valid pointer");
}- In
Float.c:29:
static i64 float_add_i64_checked(i64 a, i64 b) {
if ((b > 0 && a > INT64_MAX - b) || (b < 0 && a < INT64_MIN - b)) {
LOG_FATAL("Float exponent overflow");
}- In
Float.c:37:
static i64 float_sub_i64_checked(i64 a, i64 b) {
if ((b > 0 && a < INT64_MIN + b) || (b < 0 && a > INT64_MAX + b)) {
LOG_FATAL("Float exponent overflow");
}- In
Float.c:57:
static bool float_try_from_ieee_bits(Float *out, u64 mantissa, int binexp, bool negative, Allocator *alloc) {
if (!out) {
LOG_FATAL("Invalid arguments");
}
*out = FloatInit(alloc);- In
Float.c:102:
static bool float_try_from_f32_value(Float *out, float value, Allocator *alloc) {
if (!out) {
LOG_FATAL("Invalid arguments");
}
union {- In
Float.c:113:
u32 m = bits & 0x7FFFFFu;
if (e == 0xFFu) {
LOG_FATAL("Float from f32 does not represent finite values (Inf/NaN)");
}
u64 mantissa;- In
Float.c:131:
static bool float_try_from_f64_value(Float *out, double value, Allocator *alloc) {
if (!out) {
LOG_FATAL("Invalid arguments");
}
union {- In
Float.c:142:
u64 m = bits & 0xFFFFFFFFFFFFFull;
if (e == 0x7FFull) {
LOG_FATAL("Float from f64 does not represent finite values (Inf/NaN)");
}
u64 mantissa;- In
Float.c:166:
if (!out) {
LOG_FATAL("Invalid arguments");
}
if (!int_try_from_u64(&base, 10, alloc) || !int_try_from_u64(&result, 1, alloc)) {- In
Float.c:192:
}
if (target_exponent > value->exponent) {
LOG_FATAL("target exponent must not exceed current exponent");
}
if (target_exponent == value->exponent) {- In
Float.c:222:
ValidateFloat(rhs);
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:295:
bool FloatTryClone(Float *out, const Float *value) {
if (!out || !value) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:313:
static bool float_try_from_u64_value(Float *out, u64 value, Allocator *alloc) {
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:330:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:349:
static bool float_try_from_int_value(Float *out, const Int *value) {
if (!out || !value) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:471:
if (!out || !text) {
LOG_FATAL("Invalid arguments");
}- In
Float.c:582:
bool float_try_from_str_zstr(Float *out, Zstr text) {
if (!out || !text) {
LOG_FATAL("Invalid arguments");
}
return float_try_from_str_impl(out, text, (size)ZstrLen(text));- In
Float.c:589:
bool float_try_from_str_str(Float *out, const Str *text) {
if (!out || !text) {
LOG_FATAL("Invalid arguments");
}
return float_try_from_str_impl(out, StrBegin(text), StrLen(text));- In
Float.c:614:
ValidateFloat(value);
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:93:
bool str_try_init_from_cstr(Str *out, Zstr cstr, size len, Allocator *alloc) {
if (!out || !cstr) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:124:
bool StrInitCopy(Str *dst, const Str *src) {
if (!dst || !src) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:137:
ValidateStr(src);
if (!dst) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:284:
StrIters str_split_to_iters_str(Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");
}
return str_split_to_iters_impl(s, key->data, key->length);- In
Str.c:323:
Strs str_split_str(Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");
}
return str_split_impl(s, key->data, key->length);- In
Str.c:334:
if (!key) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:351:
size str_index_of_zstr(const Str *s, Zstr key) {
if (!key) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:359:
size str_index_of_str(const Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:381:
bool str_contains_str(const Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");
}- In
Str.c:866:
if (!value) {
LOG_FATAL("NULL output pointer");
}- In
Str.c:953:
if (!value) {
LOG_FATAL("NULL output pointer");
}- In
Str.c:1013:
if (!value) {
LOG_FATAL("NULL output pointer");
}- In
Map.c:82:
static size map_validate_policy_index(size idx, size capacity, Zstr callback_name) {
if (capacity && idx >= capacity) {
LOG_FATAL("{} returned index {} for capacity {}", callback_name, idx, capacity);
}- In
Map.c:104:
if (!policy) {
LOG_FATAL("Expected a valid MapPolicy pointer");
}- In
Map.c:108:
if (!policy->name || !policy->name[0]) {
LOG_FATAL("MapPolicy must have a non-empty name");
}- In
Map.c:112:
if (!policy->should_rehash || !policy->next_capacity || !policy->first_index || !policy->next_index) {
LOG_FATAL("MapPolicy '{}' must provide all required callbacks", policy->name);
}- In
Map.c:116:
if (policy->max_probe_count == 0) {
LOG_FATAL("MapPolicy '{}' must provide a non-zero max_probe_count", policy->name);
}- In
Map.c:130:
if ((next0 == 0) && ((length != 0) || (capacity != 0) || (tombstones != 0))) {
LOG_FATAL("MapPolicy '{}' returned zero capacity for a non-empty snapshot", policy->name);
}- In
Map.c:134:
if ((next_same != 0) && (next_same < length)) {
LOG_FATAL("MapPolicy '{}' returned capacity smaller than current length", policy->name);
}- In
Map.c:138:
if (next_more < ((size)length + 1)) {
LOG_FATAL("MapPolicy '{}' returned capacity smaller than requested minimum entries", policy->name);
}
}- In
Map.c:151:
if (next == first) {
LOG_FATAL("MapPolicy '{}' produced a stuck probe sequence for capacity {}", policy->name, capacity);
}
}- In
Map.c:300:
limit = map->policy.max_probe_count;
if (limit == 0) {
LOG_FATAL("Map policy '{}' has invalid max_probe_count", map->policy.name);
}- In
Map.c:400:
static void validate_map_structural(const GenericMap *map) {
if (!map->key_compare || !map->key_hash) {
LOG_FATAL("Map must have valid key compare and key hash callbacks");
}
if (!map->allocator) {- In
Map.c:403:
}
if (!map->allocator) {
LOG_FATAL("Map allocator pointer is NULL");
}
if (!map->allocator->allocate || !map->allocator->resize || !map->allocator->remap || !map->allocator->deallocate) {- In
Map.c:406:
}
if (!map->allocator->allocate || !map->allocator->resize || !map->allocator->remap || !map->allocator->deallocate) {
LOG_FATAL("Map allocator is invalid");
}
validate_map_policy(&map->policy);- In
Map.c:410:
validate_map_policy(&map->policy);
if (map->length > map->capacity) {
LOG_FATAL("Map length cannot exceed capacity");
}
if ((map->length + map->tombstones) > map->capacity) {- In
Map.c:413:
}
if ((map->length + map->tombstones) > map->capacity) {
LOG_FATAL("Map occupied slots and tombstones cannot exceed capacity");
}
if (!map->capacity) {- In
Map.c:417:
if (!map->capacity) {
if (map->entries || map->states) {
LOG_FATAL("Map with zero capacity must not have allocated storage");
}
return;- In
Map.c:422:
}
if (!map->entries || !map->states) {
LOG_FATAL("Map storage is corrupted");
}
}- In
Map.c:428:
void validate_map(const GenericMap *map) {
if (!map) {
LOG_FATAL("Expected a valid Map pointer");
}
if (!MAGIC_MATCHES(map->__magic, MAP_MAGIC)) {- In
Map.c:431:
}
if (!MAGIC_MATCHES(map->__magic, MAP_MAGIC)) {
LOG_FATAL("Map is uninitialized or corrupted");
}
if (!(map->__magic & MAGIC_VALIDATED_BIT)) {- In
Map.c:526:
if (new_capacity < (n > map->length ? n : (size)map->length)) {
LOG_FATAL("Map policy '{}' returned insufficient capacity {}", policy.name, new_capacity);
}- In
Map.c:673:
if (!map->value_compare) {
LOG_FATAL("MapContainsPair requires a value comparator");
}- In
Map.c:835:
if (!key || !default_value || !out_value) {
LOG_FATAL("Invalid arguments");
}- In
Map.c:1004:
if (insert_idx >= map->capacity) {
LOG_FATAL("map_insert: probe budget exhausted after 32 rehash attempts (capacity {})", map->capacity);
}- In
Map.c:1228:
if (!map->value_compare) {
LOG_FATAL("MapRemovePair requires a value comparator");
}- In
Map.c:1294:
if (!predicate) {
LOG_FATAL("MapRemoveIf requires a predicate");
}- In
Map.c:1329:
if (!predicate) {
LOG_FATAL("MapRetainIf requires a predicate");
}- In
Int.c:37:
static bool int_try_init_with_capacity(Int *out, u64 capacity, Allocator *alloc) {
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:54:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:322:
if (!out || !digits) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:376:
bool IntTryLog2(const Int *value, u64 *out) {
if (!value || !out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:443:
static bool int_try_clone_value(Int *out, const Int *value) {
if (!out || !value) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:478:
Int int_from_i64(i64 value, Allocator *alloc) {
if (value < 0) {
LOG_FATAL("Int cannot represent negative values");
}- In
Int.c:486:
bool IntTryToU64(const Int *value, u64 *out) {
if (!value || !out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:513:
Int int_from_bytes_le(const u8 *bytes, u64 len, Allocator *alloc) {
if (!bytes && len != 0) {
LOG_FATAL("bytes is NULL");
}- In
Int.c:534:
if (!bytes) {
LOG_FATAL("bytes is NULL");
}
if (max_len == 0) {- In
Int.c:537:
}
if (max_len == 0) {
LOG_FATAL("max_len is 0");
}- In
Int.c:568:
Int int_from_bytes_be(const u8 *bytes, u64 len, Allocator *alloc) {
if (!bytes && len != 0) {
LOG_FATAL("bytes is NULL");
}- In
Int.c:588:
if (!bytes) {
LOG_FATAL("bytes is NULL");
}
if (max_len == 0) {- In
Int.c:591:
}
if (max_len == 0) {
LOG_FATAL("max_len is 0");
}- In
Int.c:625:
if (!out || !decimal) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:640:
if (!out || !decimal) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:685:
if (!out || !digits) {
LOG_FATAL("Invalid arguments");
}
len = (u64)ZstrLen(digits);- In
Int.c:699:
if (!out || !digits) {
LOG_FATAL("Invalid arguments");
}
if (StrLen(digits) > 0 && StrCharAt(digits, 0) == '+') {- In
Int.c:728:
ValidateInt(value);
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:794:
if (!out || !binary) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:809:
if (!out || !binary) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:843:
if (!out || !octal) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:858:
if (!out || !octal) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:891:
if (!out || !hex) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:900:
bool int_try_from_hex_str_str(Int *out, const Str *hex) {
if (!out || !hex) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:1128:
if (!int_sub_u64(result, value, magnitude)) {
LOG_FATAL("int_add would produce a negative result");
}- In
Int.c:1269:
bool int_mul_i64(Int *result, const Int *value, i64 factor) {
if (factor < 0) {
LOG_FATAL("Int cannot be multiplied by a negative scalar");
}- In
Int.c:1343:
bool int_pow_i64(Int *result, const Int *base, i64 exponent) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");
}- In
Int.c:1356:
if (quotient == remainder) {
LOG_FATAL("quotient and remainder must be different objects");
}
if (IntIsZero(divisor)) {- In
Int.c:1701:
if (root == remainder) {
LOG_FATAL("root and remainder must be different objects");
}
if (degree == 0) {- In
Int.c:1950:
if (!out) {
LOG_FATAL("Invalid arguments");
}- In
Int.c:2175:
if (IntIsZero(modulus)) {
LOG_FATAL("modulus is zero");
}- In
Int.c:2292:
bool int_pow_i64_mod(Int *result, const Int *base, i64 exponent, const Int *modulus) {
if (exponent < 0) {
LOG_FATAL("Int exponent cannot be negative");
}- In
Mutex.c:98:
Mutex *MutexLock(Mutex *m) {
if (!m) {
LOG_FATAL("MutexLock: NULL mutex");
}
#if PLATFORM_WINDOWS- In
Mutex.c:138:
Mutex *MutexUnlock(Mutex *m) {
if (!m) {
LOG_FATAL("MutexUnlock: NULL mutex");
}
#if PLATFORM_WINDOWS bool symbol_resolver_init(SymbolResolver *out, Allocator *alloc) {
if (!out || !alloc) {
LOG_FATAL("SymbolResolverInit: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:382:
bool socket_addr_parse_zstr(SocketAddr *out, Zstr spec, SocketKind kind) {
if (!out) {
LOG_FATAL("SocketAddrParse: out is NULL");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:441:
bool socket_addr_parse_str(SocketAddr *out, const Str *spec, SocketKind kind) {
if (!out) {
LOG_FATAL("SocketAddrParse: out is NULL");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:743:
bool ListenerOpen(Listener *out, SocketKind kind, const SocketAddr *addr, i32 backlog) {
if (!out || !addr) {
LOG_FATAL("ListenerOpen: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:800:
bool ListenerLocalAddr(const Listener *self, SocketAddr *out) {
if (!self || !out) {
LOG_FATAL("ListenerLocalAddr: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:814:
bool ListenerAccept(Listener *self, Socket *out_conn) {
if (!self || !out_conn) {
LOG_FATAL("ListenerAccept: NULL argument");
}
MemSet(out_conn, 0, sizeof(*out_conn));- In
Socket.c:849:
bool SocketConnect(Socket *out, SocketKind kind, const SocketAddr *target) {
if (!out || !target) {
LOG_FATAL("SocketConnect: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Socket.c:880:
i64 SocketRecv(Socket *self, void *buf, size n) {
if (!self || !buf) {
LOG_FATAL("SocketRecv: NULL argument");
}
return plat_recv(self->fd, buf, n);- In
Socket.c:887:
i64 SocketSend(Socket *self, const void *buf, size n) {
if (!self || !buf) {
LOG_FATAL("SocketSend: NULL argument");
}
return plat_send(self->fd, buf, n);- In
Socket.c:966:
i32 SocketPoll(SocketPollItem *items, u32 count, i32 timeout_ms) {
if (!items && count > 0) {
LOG_FATAL("SocketPoll: items is NULL but count > 0");
}- In
Proc.c:267:
ProcStatus ProcWait(Proc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");
}- In
Proc.c:314:
ProcStatus ProcWaitFor(Proc *proc, u64 timeout_ms) {
if (!proc) {
LOG_FATAL("Invalid arguments");
}- In
Proc.c:388:
void ProcTerminate(Proc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");
}- In
Proc.c:467:
i32 ProcWriteToStdin(Proc *proc, const Str *buf) {
if (!proc || !buf) {
LOG_FATAL("Invalid arguments");
}- In
Proc.c:482:
static i32 proc_read_internal(Proc *proc, Str *buf, bool is_stdout) {
if (!proc || !buf) {
LOG_FATAL("Invalid argument");
}- In
Proc.c:569:
i32 ProcGetId(Proc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");
}- In
Proc.c:581:
ProcStatus ProcGetStatus(Proc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");
}- In
Proc.c:620:
i32 ProcGetExitCode(Proc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");
}- In
ProcMaps.c:171:
bool proc_maps_load(ProcMaps *out, Allocator *alloc) {
if (!out || !alloc) {
LOG_FATAL("ProcMapsLoad: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Dir.c:43:
DirEntry *DirEntryInitCopy(DirEntry *dst, const DirEntry *src) {
if (!dst || !src) {
LOG_FATAL("Invalid arguments");
}- In
Dir.c:54:
DirEntry *DirEntryDeinitCopy(DirEntry *copy) {
if (!copy) {
LOG_FATAL("Invalid arguments");
}- In
Dir.c:67:
DirContents dir_get_contents(Zstr path, Allocator *alloc) {
if (!path || !alloc) {
LOG_FATAL("Invalid argument");
}- In
Dir.c:195:
DirContents dir_get_contents(Zstr path, Allocator *alloc) {
if (!path || !alloc) {
LOG_FATAL("Invalid arguments");
}- In
Dir.c:342:
i8 file_remove(Zstr path) {
if (!path) {
LOG_FATAL("FileRemove: NULL path");
}
#if PLATFORM_WINDOWS- In
Dir.c:371:
i8 dir_remove(Zstr path) {
if (!path) {
LOG_FATAL("DirRemove: NULL path");
}
#if PLATFORM_WINDOWS- In
Dir.c:412:
i8 dir_create(Zstr path) {
if (!path) {
LOG_FATAL("DirCreate: NULL path");
}
#if PLATFORM_WINDOWS- In
Dir.c:465:
i8 dir_create_all(Zstr path) {
if (!path) {
LOG_FATAL("DirCreateAll: NULL path");
}
size n = ZstrLen(path);- In
Dir.c:525:
i8 dir_remove_all(Zstr path) {
if (!path) {
LOG_FATAL("DirRemoveAll: NULL path");
}
// Stat first: a missing path is a successful no-op (mirrors
- In
Http.c:21:
void HttpHeaderDeinit(HttpHeader *header) {
if (!header) {
LOG_FATAL("invalid arguments");
}
StrDeinit(&header->key);- In
Http.c:38:
bool http_header_init_copy(void *dst_ptr, const void *src_ptr, const Allocator *alloc) {
if (!dst_ptr || !src_ptr || !alloc) {
LOG_FATAL("invalid arguments");
}
HttpHeader *dst = (HttpHeader *)dst_ptr;- In
Http.c:60:
HttpHeader *http_headers_find_zstr(HttpHeaders *headers, Zstr key) {
if (!headers || !key) {
LOG_FATAL("invalid arguments");
}
VecForeachPtr(headers, header) {- In
Http.c:72:
HttpHeader *http_headers_find_str(HttpHeaders *headers, const Str *key) {
if (!headers || !key) {
LOG_FATAL("invalid arguments");
}
// Str values are NUL-terminated by construction; comparison scans
- In
Http.c:110:
Zstr http_request_parse_zstr(HttpRequest *req, Zstr in) {
if (!req || !req->allocator || !in) {
LOG_FATAL("invalid arguments");
}- In
Http.c:179:
Zstr http_request_parse_str(HttpRequest *req, const Str *in) {
if (!req || !in) {
LOG_FATAL("invalid arguments");
}
// Str values are NUL-terminated by construction; the underlying
- In
Http.c:189:
void HttpRequestDeinit(HttpRequest *req) {
if (!req) {
LOG_FATAL("invalid arguments");
}
StrDeinit(&req->url);- In
Http.c:410:
HttpResponse *HttpRespondWithHtml(HttpResponse *response, HttpResponseCode status, const Str *html) {
if (!response || !response->allocator || !html) {
LOG_FATAL("invalid arguments");
}
response->status_code = status;- In
Http.c:427:
) {
if (!response || !response->allocator || !filepath) {
LOG_FATAL("invalid arguments");
}
response->status_code = status;- In
Http.c:447:
) {
if (!filepath) {
LOG_FATAL("invalid arguments");
}
return http_respond_with_file_zstr(response, status, content_type, (Zstr)StrBegin(filepath));- In
Http.c:457:
if (!response) {
LOG_FATAL("HttpResponseSerialize: response is NULL");
}- In
Http.c:499:
void HttpResponseDeinit(HttpResponse *response) {
if (!response) {
LOG_FATAL("invalid arguments");
}
StrDeinit(&response->body);- In
KvConfig.c:23:
static bool kvconfig_parse_bool_value(const Str *value, bool *out) {
if (!out) {
LOG_FATAL("Expected valid bool output pointer");
}- In
KvConfig.c:48:
if (!out) {
LOG_FATAL("Expected valid integer output pointer");
}- In
KvConfig.c:66:
if (!out) {
LOG_FATAL("Expected valid float output pointer");
}- In
KvConfig.c:110:
if (!key) {
LOG_FATAL("Expected valid key output string");
}- In
KvConfig.c:138:
if (!value) {
LOG_FATAL("Expected valid value output string");
}- In
KvConfig.c:226:
if (!key || !value) {
LOG_FATAL("Expected valid key/value outputs");
}- In
KvConfig.c:276:
if (!cfg) {
LOG_FATAL("Expected valid KvConfig object");
}- In
MachO.c:421:
bool MachoOpenFromMemory(Macho *out, Buf *in) {
if (!out || !in || !BufData(in) || !BufAllocator(in)) {
LOG_FATAL("MachoOpenFromMemory: NULL argument (contract violation)");
}
Buf taken = *in;- In
MachO.c:449:
bool macho_open_from_memory_copy(Macho *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("MachoOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
MachO.c:463:
bool macho_open(Macho *out, Zstr path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_FATAL("MachoOpen: NULL argument (contract violation)");
}
Buf data = BufInit(alloc);- In
JSON.c:187:
if (!str) {
LOG_FATAL("Invalid str object to read into.");
}- In
JSON.c:305:
if (!num) {
LOG_FATAL("Invalid number object.");
}- In
JSON.c:450:
if (!val) {
LOG_FATAL("Invalid pointer to integer. Don't know where to store.");
}- In
JSON.c:478:
if (!val) {
LOG_FATAL("Invalid pointer to float. Don't know where to store.");
}- In
JSON.c:505:
if (!b) {
LOG_FATAL("Invalid boolean pointer. Don't know where to store.");
}- In
JSON.c:554:
if (!is_null) {
LOG_FATAL("Invalid boolean pointer. Don't know where to store.");
}- In
Elf.c:435:
bool ElfOpenFromMemory(Elf *out, Buf *in) {
if (!out || !in || !BufData(in) || !BufAllocator(in)) {
LOG_FATAL("ElfOpenFromMemory: NULL argument (contract violation)");
}
Buf taken = *in;- In
Elf.c:463:
bool elf_open_from_memory_copy(Elf *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("ElfOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
Elf.c:479:
bool elf_open(Elf *out, Zstr path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_FATAL("ElfOpen: NULL argument (contract violation)");
}
Buf data = BufInit(alloc);- In
Dwarf.c:542:
bool dwarf_lines_build_from_elf(DwarfLines *out, const Elf *elf, Allocator *alloc) {
if (!out || !elf || !alloc) {
LOG_FATAL("DwarfLinesBuildFromElf: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
DwarfInfo.c:521:
) {
if (!out || !alloc) {
LOG_FATAL("DwarfFunctionsBuildFromSlices: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
DwarfInfo.c:643:
bool dwarf_functions_build_from_elf(DwarfFunctions *out, const Elf *elf, Allocator *alloc) {
if (!out || !elf || !alloc) {
LOG_FATAL("DwarfFunctionsBuildFromElf: NULL argument");
}
const ElfSection *info_sec = ElfFindSection(elf, ".debug_info");- 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:732:
bool pdb_open_from_memory_copy(Pdb *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("PdbOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
Pdb.c:746:
bool pdb_open(Pdb *out, Zstr path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_FATAL("PdbOpen: NULL argument (contract violation)");
}
Buf data = BufInit(alloc); bool dwarf_cfi_build_from_elf(DwarfCfi *out, const Elf *elf, Allocator *alloc) {
if (!out || !elf || !alloc) {
LOG_FATAL("DwarfCfiBuildFromElf: NULL argument");
}
MemSet(out, 0, sizeof(*out));- In
Pe.c:508:
bool PeOpenFromMemory(Pe *out, Buf *in) {
if (!out || !in || !BufData(in) || !BufAllocator(in)) {
LOG_FATAL("PeOpenFromMemory: NULL argument (contract violation)");
}
Buf taken = *in;- In
Pe.c:544:
bool pe_open_from_memory_copy(Pe *out, const u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_FATAL("PeOpenFromMemoryCopy: NULL argument (contract violation)");
}
Buf copy = BufInit(alloc);- In
Pe.c:558:
bool pe_open(Pe *out, Zstr path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_FATAL("PeOpen: NULL argument (contract violation)");
}
Buf data = BufInit(alloc);
Node *p = (Node *)AllocatorAlloc(alloc1, sizeof(Node), false);
AllocatorFree(alloc2, p); // foreign to bp2 -> LOG_FATAL
return false;
} // exposing it would invite misuse); the test needs a non-NULL
// pointer in the bitmap region to exercise the foreign-ptr check.
AllocatorFree(alloc, bp.bitmap); // bitmap region -> LOG_FATAL
return false;
} Allocator *alloc = ALLOCATOR_OF(&bp);
char *p = (char *)AllocatorAlloc(alloc, sizeof(Node), false);
AllocatorFree(alloc, p + 1); // mis-aligned -> LOG_FATAL
return false;
} Node *p = (Node *)AllocatorAlloc(alloc, sizeof(Node), false);
AllocatorFree(alloc, p);
AllocatorFree(alloc, p); // bit already 0 -> LOG_FATAL
return false;
} Allocator *a2 = ALLOCATOR_OF(&s2);
Node *p = (Node *)AllocatorAlloc(a1, sizeof(Node), false);
AllocatorFree(a2, p); // foreign to s2 -> LOG_FATAL
return false;
} Allocator *alloc = ALLOCATOR_OF(&slab);
u8 *p = (u8 *)AllocatorAlloc(alloc, sizeof(Node), false);
AllocatorFree(alloc, p + 1); // mis-aligned -> LOG_FATAL
return false;
} Node *p = (Node *)AllocatorAlloc(alloc, sizeof(Node), false);
AllocatorFree(alloc, p);
AllocatorFree(alloc, p); // bit already 0 -> LOG_FATAL
return false;
}- In
AllocDebug.c:300:
void *p = AllocatorAlloc(adbg, 32, true);
AllocatorFree(adbg, p);
AllocatorFree(adbg, p); // -> Heap LOG_FATAL
return false; // unreachable
} Allocator *alloc2 = ALLOCATOR_OF(&h2);
void *p = AllocatorAlloc(alloc1, 32, false);
AllocatorFree(alloc2, p); // foreign to h2 -> LOG_FATAL
return false; // unreachable
} void *p = AllocatorAlloc(alloc, 32, false);
AllocatorFree(alloc, p);
AllocatorFree(alloc, p); // bit already 0 -> LOG_FATAL
return false;
} Allocator *alloc = ALLOCATOR_OF(&heap);
u8 *p = (u8 *)AllocatorAlloc(alloc, 64, false);
AllocatorFree(alloc, p + 1); // mis-aligned -> LOG_FATAL
return false;
} size n = 16 * 1024;
u8 *p = (u8 *)AllocatorAlloc(alloc, n, false);
AllocatorFree(alloc, p + 128); // mid-allocation -> LOG_FATAL
return false;
} u8 *b = (u8 *)AllocatorAlloc(alloc_base, 16, true);
(void)b;
(void)AllocatorRealloc(alloc_base, a, 64); // -> LOG_FATAL
return false; // unreachable
} Allocator *alloc_base = ALLOCATOR_OF(&arena);
char stack_byte = 0;
AllocatorFree(alloc_base, &stack_byte); // -> LOG_FATAL
return false; // unreachable
} BitVecPush(&pattern, true);
BitVecFindPattern(NULL, &pattern); // Should cause LOG_FATAL
BitVecDeinit(&pattern); BitVecPush(&source, false);
BitVecFindPattern(&source, NULL); // Should cause LOG_FATAL
BitVecDeinit(&source); BitVecPush(&pattern, true);
BitVecFindLastPattern(NULL, &pattern); // Should cause LOG_FATAL
BitVecDeinit(&pattern); BitVecPush(&source, false);
BitVecFindLastPattern(&source, NULL); // Should cause LOG_FATAL
BitVecDeinit(&source);
// Don't create pattern BitVec since we're testing NULL source validation
BitVecFindAllPattern(NULL, (BitVec *)0x1, results, 10); // Should cause LOG_FATAL
return true; BitVecPush(&source, false);
BitVecFindAllPattern(&source, NULL, results, 10); // Should cause LOG_FATAL
BitVecDeinit(&source); BitVecPush(&pattern, true);
BitVecFindAllPattern(&source, &pattern, NULL, 10); // Should cause LOG_FATAL
BitVecDeinit(&source); BitVecPush(&pattern, true);
BitVecFindAllPattern(&source, &pattern, results, 0); // Should cause LOG_FATAL
BitVecDeinit(&source);- In
Access.h:126:
do { \
if (!IterRead((mi), (out))) { \
LOG_FATAL("IterMustRead: iterator exhausted"); \
} \
} while (0)- In
Access.h:159:
do { \
if (!IterPeekAt((mi), (n), (out))) { \
LOG_FATAL("IterMustPeekAt: offset out of range"); \
} \
} while (0)- In
Move.h:38:
do { \
if (!IterMove((mi), (n))) { \
LOG_FATAL("IterMustMove: target position out of range"); \
} \
} while (0)- In
Insert.h:124:
do { \
if (!GraphAddNodeL((g), (lval))) { \
LOG_FATAL("GraphMustAddNodeL failed"); \
} \
} while (0)- In
Insert.h:142:
do { \
if (!GraphAddNodeR((g), (rval))) { \
LOG_FATAL("GraphMustAddNodeR failed"); \
} \
} while (0)- In
Insert.h:173:
do { \
if (!GraphAddEdge((g), (from), (to))) { \
LOG_FATAL("GraphMustAddEdge failed"); \
} \
} while (0)- In
Memory.h:61:
do { \
if (!GraphReserve((g), (n))) { \
LOG_FATAL("GraphMustReserve failed"); \
} \
} while (0)- In
Ops.h:60:
do { \
if (!ListSort((l), (compare))) { \
LOG_FATAL("ListMustSort failed"); \
} \
} while (0)- In
Insert.h:296:
do { \
if (!ListInsertL((l), (lval), (idx))) { \
LOG_FATAL("ListMustInsertL failed"); \
} \
} while (0)- In
Insert.h:313:
do { \
if (!ListInsertR((l), (rval), (idx))) { \
LOG_FATAL("ListMustInsertR failed"); \
} \
} while (0)- In
Insert.h:330:
do { \
if (!ListInsert((l), (lval), (idx))) { \
LOG_FATAL("ListMustInsert failed"); \
} \
} while (0)- In
Insert.h:348:
do { \
if (!ListPushFrontL((l), (lval))) { \
LOG_FATAL("ListMustPushFrontL failed"); \
} \
} while (0)- In
Insert.h:365:
do { \
if (!ListPushFrontR((l), (rval))) { \
LOG_FATAL("ListMustPushFrontR failed"); \
} \
} while (0)- In
Insert.h:382:
do { \
if (!ListPushFront((l), (lval))) { \
LOG_FATAL("ListMustPushFront failed"); \
} \
} while (0)- In
Insert.h:400:
do { \
if (!ListPushBackL((l), (lval))) { \
LOG_FATAL("ListMustPushBackL failed"); \
} \
} while (0)- In
Insert.h:417:
do { \
if (!ListPushBackR((l), (rval))) { \
LOG_FATAL("ListMustPushBackR failed"); \
} \
} while (0)- In
Insert.h:434:
do { \
if (!ListPushBack((l), (lval))) { \
LOG_FATAL("ListMustPushBack failed"); \
} \
} while (0)- In
Insert.h:452:
do { \
if (!ListPushArrL((l), (arr), (count))) { \
LOG_FATAL("ListMustPushArrL failed"); \
} \
} while (0)- In
Insert.h:469:
do { \
if (!ListPushArrR((l), (arr), (count))) { \
LOG_FATAL("ListMustPushArrR failed"); \
} \
} while (0)- In
Insert.h:486:
do { \
if (!ListPushArr((l), (arr), (count))) { \
LOG_FATAL("ListMustPushArr failed"); \
} \
} while (0)- In
Insert.h:504:
do { \
if (!ListMergeL((l), (l2))) { \
LOG_FATAL("ListMustMergeL failed"); \
} \
} while (0)- In
Insert.h:521:
do { \
if (!ListMergeR((l), (l2))) { \
LOG_FATAL("ListMustMergeR failed"); \
} \
} while (0)- In
Insert.h:538:
do { \
if (!ListMerge((l), (l2))) { \
LOG_FATAL("ListMustMerge failed"); \
} \
} while (0)- In
Insert.h:554:
do { \
if (!VecInsertL((v), (lval), (idx))) { \
LOG_FATAL("VecMustInsertL failed"); \
} \
} while (0)- In
Insert.h:571:
do { \
if (!VecInsertR((v), (rval), (idx))) { \
LOG_FATAL("VecMustInsertR failed"); \
} \
} while (0)- In
Insert.h:588:
do { \
if (!VecInsert((v), (lval), (idx))) { \
LOG_FATAL("VecMustInsert failed"); \
} \
} while (0)- In
Insert.h:606:
do { \
if (!VecInsertFastL((v), (lval), (idx))) { \
LOG_FATAL("VecMustInsertFastL failed"); \
} \
} while (0)- In
Insert.h:623:
do { \
if (!VecInsertFastR((v), (rval), (idx))) { \
LOG_FATAL("VecMustInsertFastR failed"); \
} \
} while (0)- In
Insert.h:640:
do { \
if (!VecInsertFast((v), (lval), (idx))) { \
LOG_FATAL("VecMustInsertFast failed"); \
} \
} while (0)- In
Insert.h:658:
do { \
if (!VecInsertRangeL((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRangeL failed"); \
} \
} while (0)- In
Insert.h:675:
do { \
if (!VecInsertRangeR((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRangeR failed"); \
} \
} while (0)- In
Insert.h:692:
do { \
if (!VecInsertRange((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRange failed"); \
} \
} while (0)- In
Insert.h:710:
do { \
if (!VecInsertRangeFastL((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRangeFastL failed"); \
} \
} while (0)- In
Insert.h:727:
do { \
if (!VecInsertRangeFastR((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRangeFastR failed"); \
} \
} while (0)- In
Insert.h:744:
do { \
if (!VecInsertRangeFast((v), (varr), (idx), (count))) { \
LOG_FATAL("VecMustInsertRangeFast failed"); \
} \
} while (0)- In
Insert.h:762:
do { \
if (!VecPushBackArrL((v), (arr), (count))) { \
LOG_FATAL("VecMustPushBackArrL failed"); \
} \
} while (0)- In
Insert.h:779:
do { \
if (!VecPushBackArrR((v), (arr), (count))) { \
LOG_FATAL("VecMustPushBackArrR failed"); \
} \
} while (0)- In
Insert.h:796:
do { \
if (!VecPushBackArr((v), (arr), (count))) { \
LOG_FATAL("VecMustPushBackArr failed"); \
} \
} while (0)- In
Insert.h:814:
do { \
if (!VecPushFrontArrL((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrL failed"); \
} \
} while (0)- In
Insert.h:831:
do { \
if (!VecPushFrontArrR((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrR failed"); \
} \
} while (0)- In
Insert.h:848:
do { \
if (!VecPushFrontArr((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArr failed"); \
} \
} while (0)- In
Insert.h:866:
do { \
if (!VecPushFrontArrFastL((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrFastL failed"); \
} \
} while (0)- In
Insert.h:883:
do { \
if (!VecPushFrontArrFastR((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrFastR failed"); \
} \
} while (0)- In
Insert.h:900:
do { \
if (!VecPushFrontArrFast((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrFast failed"); \
} \
} while (0)- In
Insert.h:918:
do { \
if (!VecMergeL((v), (v2))) { \
LOG_FATAL("VecMustMergeL failed"); \
} \
} while (0)- In
Insert.h:935:
do { \
if (!VecMergeR((v), (v2))) { \
LOG_FATAL("VecMustMergeR failed"); \
} \
} while (0)- In
Insert.h:952:
do { \
if (!VecMerge((v), (v2))) { \
LOG_FATAL("VecMustMerge failed"); \
} \
} while (0)- In
Insert.h:970:
do { \
if (!VecPushBackL((v), (val))) { \
LOG_FATAL("VecMustPushBackL failed"); \
} \
} while (0)- In
Insert.h:987:
do { \
if (!VecPushBackR((v), (val))) { \
LOG_FATAL("VecMustPushBackR failed"); \
} \
} while (0)- In
Insert.h:1004:
do { \
if (!VecPushBack((v), (val))) { \
LOG_FATAL("VecMustPushBack failed"); \
} \
} while (0)- In
Insert.h:1022:
do { \
if (!VecPushFrontL((v), (val))) { \
LOG_FATAL("VecMustPushFrontL failed"); \
} \
} while (0)- In
Insert.h:1039:
do { \
if (!VecPushFrontR((v), (val))) { \
LOG_FATAL("VecMustPushFrontR failed"); \
} \
} while (0)- In
Insert.h:1056:
do { \
if (!VecPushFront((v), (val))) { \
LOG_FATAL("VecMustPushFront failed"); \
} \
} while (0)- In
Insert.h:1074:
do { \
if (!VecInitClone((vd), (vs))) { \
LOG_FATAL("VecMustInitClone failed"); \
} \
} while (0)- In
Memory.h:41:
do { \
if (!VecTryReduceSpace((v))) { \
LOG_FATAL("VecTryReduceSpace failed"); \
} \
} while (0)- In
Memory.h:77:
do { \
if (!VecResize((v), (len))) { \
LOG_FATAL("VecResize failed"); \
} \
} while (0)- In
Memory.h:108:
do { \
if (!VecReserve((v), (n))) { \
LOG_FATAL("VecReserve failed"); \
} \
} while (0)- In
Init.h:28:
do { \
if (!BitVecReserve((bv), (n))) { \
LOG_FATAL("BitVecMustReserve failed"); \
} \
} while (0)- In
Init.h:46:
do { \
if (!BitVecResize((bv), (n))) { \
LOG_FATAL("BitVecMustResize failed"); \
} \
} while (0)- In
Insert.h:31:
do { \
if (!BitVecInsertRange((bv), (idx), (count), (value))) { \
LOG_FATAL("BitVecMustInsertRange failed"); \
} \
} while (0)- In
Insert.h:48:
do { \
if (!BitVecInsertMultiple((bv), (idx), (other))) { \
LOG_FATAL("BitVecMustInsertMultiple failed"); \
} \
} while (0)- In
Insert.h:65:
do { \
if (!BitVecInsertPattern((bv), (idx), (pattern), (pattern_bits))) { \
LOG_FATAL("BitVecMustInsertPattern failed"); \
} \
} while (0)- In
Insert.h:82:
do { \
if (!BitVecPush((bv), (value))) { \
LOG_FATAL("BitVecMustPush failed"); \
} \
} while (0)- In
Insert.h:99:
do { \
if (!BitVecInsert((bv), (idx), (value))) { \
LOG_FATAL("BitVecMustInsert failed"); \
} \
} while (0)- In
Insert.h:468:
do { \
if (!MapInsertL((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustInsertL failed"); \
} \
} while (0)- In
Insert.h:485:
do { \
if (!MapInsertR((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustInsertR failed"); \
} \
} while (0)- In
Insert.h:502:
do { \
if (!MapInsert((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustInsert failed"); \
} \
} while (0)- In
Insert.h:520:
do { \
if (!MapSetFirstL((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustSetFirstL failed"); \
} \
} while (0)- In
Insert.h:537:
do { \
if (!MapSetFirstR((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustSetFirstR failed"); \
} \
} while (0)- In
Insert.h:555:
do { \
if (!MapSetOnlyL((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustSetOnlyL failed"); \
} \
} while (0)- In
Insert.h:572:
do { \
if (!MapSetOnlyR((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustSetOnlyR failed"); \
} \
} while (0)- In
Insert.h:589:
do { \
if (!MapSet((m), (in_key), (in_value))) { \
LOG_FATAL("MapMustSet failed"); \
} \
} while (0)- In
Memory.h:76:
do { \
if (!MapReserve((m), (n))) { \
LOG_FATAL("MapMustReserve failed"); \
} \
} while (0)- In
Memory.h:118:
do { \
if (!MapCompact((m))) { \
LOG_FATAL("MapMustCompact failed"); \
} \
} while (0)- In
Memory.h:162:
do { \
if (!MapRehashWithPolicy((m), (n), (policy_value))) { \
LOG_FATAL("MapMustRehashWithPolicy failed"); \
} \
} while (0)
Last updated on