x_arena_alloc
Allocate memory from the arena (aligned to X_ARENA_ALIGN).
X_ARENA_API void * x_arena_alloc(
XArena *arena,
size_t size
);
Parameters
XArena *arena
- The arena to alloc from.
size_t size
- The size in bytes to alloc.
Returns
Pointer to the allocated memory region
x_arena_alloc_zero
Allocate zero-initialized memory from the arena.
X_ARENA_API void * x_arena_alloc_zero(
XArena *arena,
size_t size
);
Parameters
XArena *arena
- The arena to alloc from.
size_t size
- The size in bytes to alloc.
Returns
Pointer to the allocated memory region
x_arena_slicedup
Duplicate a slice into the arena.
X_ARENA_API char * x_arena_slicedup(
XArena *arena,
const char *ptr,
size_t len,
bool null_terminate
);
Parameters
XArena *arena
- The arena to allocate string from.
const char *ptr
- Pointer to a beggining of the data to duplicate into the arena.
size_t len
- How much data to copy from `ptr` into the arena.
Returns
Pointer to the allocated memory region
x_arena_strdup
Duplicate a C-string into the arena.
X_ARENA_API char * x_arena_strdup(
XArena *arena,
const char *cstr
);
Parameters
XArena *arena
- The arena to allocate string from.
const char *cstr
- Pointer to a c string to duplicate into the arena.
Returns
Pointer to the allocated memory region