ARENA_ALLOCATOR_MAGIC
Description
Per-type magic for ArenaAllocator. Stamped into Allocator.base.__magic by ArenaAllocatorInit*. The arena implementation functions validate this exact value so other allocator instances reinterpreted as an ArenaAllocator * are rejected at runtime as type-confusion.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Arena.h:174:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = ARENA_ALLOCATOR_MAGIC | MAGIC_VALIDATED_BIT, \
.footprint_bytes = 0}, \
.head = NULL, \
- In
Arena.h:204:
.effort = ALLOCATOR_EFFORT_ONCE, \
.retry_limit = 0, \
.__magic = ARENA_ALLOCATOR_MAGIC | MAGIC_VALIDATED_BIT, \
.footprint_bytes = 0}, \
.head = NULL, \
- In
Arena.c:48:
LOG_FATAL("ArenaAllocator: NULL self");
}
if (!MAGIC_MATCHES(self->base.__magic, ARENA_ALLOCATOR_MAGIC)) {
LOG_FATAL("type-confusion: allocator passed to arena_allocator_* is not an ArenaAllocator");
}
Last updated on