MISRA_PAGE_ALLOCATOR_MAGIC
Description
Per-type magic for PageAllocator. Stamped into Allocator.base.__magic by PageAllocatorInit*. The page implementation functions validate this exact value so a HeapAllocator / ArenaAllocator / PoolAllocator reinterpreted as a PageAllocator * is rejected at runtime as type-confusion.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Page.c:17:
static void page_validate_self(const Allocator *self) {
if (!self || self->__magic != MISRA_PAGE_ALLOCATOR_MAGIC) {
LOG_FATAL("type-confusion: allocator passed to page_allocator_* is not a PageAllocator");
}- In
Page.h:84:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = MISRA_PAGE_ALLOCATOR_MAGIC}, \
.cached_page_size = 0 \
})- In
Page.h:102:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = MISRA_PAGE_ALLOCATOR_MAGIC}, \
.cached_page_size = 0 \
})
Last updated on