MISRA_BUDGET_ALLOCATOR_MAGIC
Description
Per-type magic for BudgetAllocator. Stamped into Allocator.base.__magic by BudgetAllocatorInit*. The budget implementation functions validate this exact value so other allocator instances reinterpreted as a BudgetAllocator * are rejected at runtime as type-confusion.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Budget.c:20:
static void budget_validate_self(const Allocator *self) {
if (!self || self->__magic != MISRA_BUDGET_ALLOCATOR_MAGIC) {
LOG_FATAL("type-confusion: allocator passed to budget_allocator_* is not a BudgetAllocator");
}- In
Budget.c:117:
.effort = ALLOCATOR_EFFORT_ONCE,
.retry_limit = 0,
.__magic = MISRA_BUDGET_ALLOCATOR_MAGIC},
.buf = (char *)buf,
.buf_bytes = buf_bytes,
Last updated on