MISRA_SLAB_ALLOCATOR_MAGIC
Description
Per-type magic for SlabAllocator. Stamped into Allocator.base.__magic by SlabAllocatorInit*. The slab implementation functions validate this exact value so other allocator instances reinterpreted as a SlabAllocator * are rejected at runtime as type-confusion.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Slab.c:15:
static void slab_validate_self(const Allocator *self) {
if (!self || self->__magic != MISRA_SLAB_ALLOCATOR_MAGIC) {
LOG_FATAL("type-confusion: allocator passed to slab_allocator_* is not a SlabAllocator");
}- In
Slab.h:66:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = MISRA_SLAB_ALLOCATOR_MAGIC}, \
.head = NULL, \
.tail = NULL, \
- In
Slab.h:87:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = MISRA_SLAB_ALLOCATOR_MAGIC}, \
.head = NULL, \
.tail = NULL, \
Last updated on