25 if (out == NULL)
return NULL;
39 if (out == NULL)
return NULL;
59 if (ptr == NULL)
return NULL;
STA_DECL void arena_opt_free(void *ptr, size_t size, arena_t *arena)
STA_DECL void * arena_memdup(const void *ptr, size_t size, arena_t *arena)
STA_DECL void arena_free(void *ptr, size_t size, arena_t *arena)
STA_DECL char * arena_opt_strndup(const char *str, size_t len, arena_t *arena)
STA_DECL void * arena_realloc(void *ptr, size_t new_size, size_t old_size, arena_t *arena)
STA_DECL char * arena_strndup(const char *str, size_t len, arena_t *arena)
STA_DECL void * arena_opt_memdup(const void *ptr, size_t size, arena_t *arena)
STA_DECL void * arena_opt_realloc(void *ptr, size_t new_size, size_t old_size, arena_t *arena)
#define STA_DECL
sal2 annotation on function implementations to copy annotations from the declaration
CT_NOALIAS CT_BASE_API void * ctu_memcpy(STA_WRITES(size) void *CT_RESTRICT dst, STA_READS(size) const void *CT_RESTRICT src, size_t size)
copy memory from one location to another equivalent to memcpy but with safety checks
CT_NODISCARD CT_PUREFN CT_BASE_API size_t ctu_strlen(const char *str)
get the length of a string not including the null terminator equivalent to strlen but with safety che...
STA_DECL void * arena_opt_malloc_info(size_t size, const char *name, const void *parent, arena_t *arena)
allocate memory from a custom allocator
STA_DECL void * arena_opt_malloc(size_t size, arena_t *arena)
allocate memory from a custom allocator
STA_DECL char * arena_opt_strdup(const char *str, arena_t *arena)
these return NULL on failure
STA_DECL void * arena_malloc_info(size_t size, const char *name, const void *parent, arena_t *arena)
allocate memory from a custom allocator
STA_DECL void * arena_data(arena_t *arena)
get the user data pointer from an arena
#define ARENA_OPT_MALLOC(size, name, parent, arena)
STA_DECL void * arena_malloc(size_t size, arena_t *arena)
allocate memory from a custom allocator
STA_DECL void arena_reparent(const void *ptr, const void *parent, arena_t *arena)
reparent a pointer in a custom allocator
STA_DECL char * arena_strdup(const char *str, arena_t *arena)
strong oom handling
STA_DECL void arena_rename(const void *ptr, const char *name, arena_t *arena)
rename a pointer in a custom allocator
#define CTASSERT(expr)
assert a condition, prints the condition as a message
#define CTASSERTF(expr,...)
assert a condition with a message and optional format arguments
mem_resize_t fn_realloc
the realloc function
const char * name
the name of the allocator
mem_release_t fn_free
the free function
void * user
user data pointer
mem_reparent_t fn_reparent
the reparent function
mem_rename_t fn_rename
the rename function
mem_alloc_t fn_malloc
the malloc function