11#ifndef ASRT_ALLOCATOR_H
12#define ASRT_ALLOCATOR_H
18#include "./asrt_assert.h"
30 void* ( *alloc )(
void*
ptr, uint32_t size );
31 void ( *free )(
void*
ptr,
void* mem );
35static inline void* asrt_alloc(
struct asrt_allocator* a, uint32_t size )
37 ASRT_ASSERT( a && a->free );
38 return a->alloc( a->
ptr, size );
42static inline void asrt_free(
struct asrt_allocator* a,
void** mem )
44 ASRT_ASSERT( a && a->free );
46 a->free( a->
ptr, *mem );
54static inline void* asrt_call_malloc(
void* ptr, uint32_t size )
57 return malloc( size );
60static inline void asrt_call_free(
void* ptr,
void* mem )
71 .alloc = &asrt_call_malloc,
72 .free = &asrt_call_free,
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: allocator.h:28
void * ptr
Opaque context passed to alloc/free.
Definition: allocator.h:29
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: span.h:23