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.h:221:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = BUDGET_ALLOCATOR_MAGIC | MAGIC_VALIDATED_BIT, \
.footprint_bytes = 0}, \
.buf = (u8 *)(buf_ptr), \
- In
Budget.c:93:
LOG_FATAL("BudgetAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, BUDGET_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to budget_allocator_* is not a BudgetAllocator");
}
Last updated on