137 size_t nelem,
size_t elsize,
const void *data);
172 #define ucx_stack_topsize(stack) ((stack)->top ? ((struct ucx_stack_metadata*)\ 173 (stack)->top - 1)->size : 0) 188 #define ucx_stack_pop(stack, dest) ucx_stack_popn(stack, dest, (size_t)-1) 219 #define ucx_stack_empty(stack) (!(stack)->top) 231 #define ucx_stack_dim(size, elems) (size+sizeof(struct ucx_stack_metadata) * \ size_t size
Stack size.
Definition: stack.h:57
+
UCX stack structure.
Definition: stack.h:52
+
void ucx_stack_free(UcxStack *stack, void *ptr)
Frees memory on the stack.
Definition: stack.c:106
+
Main UCX Header providing most common definitions.
+
void * ucx_stack_malloc(UcxStack *stack, size_t n)
Allocates stack memory.
Definition: stack.c:53
+
void * ucx_stack_push(UcxStack *stack, size_t n, const void *data)
Allocates memory with ucx_stack_malloc() and copies the specified data if the allocation was successf...
Definition: stack.c:148
+
+
void * ucx_stack_realloc(UcxStack *stack, void *ptr, size_t n)
Reallocates memory on the stack.
Definition: stack.c:79
+
+
size_t ucx_stack_avail(UcxStack *stack)
Returns the remaining available memory on the specified stack.
Definition: stack.c:135
+
UCX allocator data structure containing memory management functions.
Definition: allocator.h:88
+
char * space
Pointer to the bottom of the stack.
Definition: stack.h:60
+
void ucx_stack_popn(UcxStack *stack, void *dest, size_t n)
Removes the top most element from the stack and copies the content to dest.
Definition: stack.c:118
+
Allocator for custom memory management.
+
void ucx_stack_init(UcxStack *stack, char *space, size_t size)
Initializes UcxStack structure with memory.
Definition: stack.c:41
+
+
void * ucx_stack_pusharr(UcxStack *stack, size_t nelem, size_t elsize, const void *data)
Allocates memory with ucx_stack_calloc() and copies the specified data if the allocation was successf...
Definition: stack.c:156
+
void * ucx_stack_calloc(UcxStack *stack, size_t nelem, size_t elsize)
Allocates an array of stack memory.
Definition: stack.c:73
+
char * top
Pointer to the top of the stack.
Definition: stack.h:63
+
UcxAllocator allocator
UcxAllocator based on this stack.
Definition: stack.h:54
+