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
universe@390:
UCX stack structure.
Definition: stack.h:52
universe@390:
void ucx_stack_free(UcxStack *stack, void *ptr)
Frees memory on the stack.
Definition: stack.c:106
universe@390:
Main UCX Header providing most common definitions.
universe@390:
void * ucx_stack_malloc(UcxStack *stack, size_t n)
Allocates stack memory.
Definition: stack.c:53
universe@390:
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
universe@390:
universe@390:
void * ucx_stack_realloc(UcxStack *stack, void *ptr, size_t n)
Reallocates memory on the stack.
Definition: stack.c:79
universe@390:
universe@390:
size_t ucx_stack_avail(UcxStack *stack)
Returns the remaining available memory on the specified stack.
Definition: stack.c:135
universe@390:
UCX allocator data structure containing memory management functions.
Definition: allocator.h:88
universe@390:
char * space
Pointer to the bottom of the stack.
Definition: stack.h:60
universe@390:
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
universe@390:
Allocator for custom memory management.
universe@390:
void ucx_stack_init(UcxStack *stack, char *space, size_t size)
Initializes UcxStack structure with memory.
Definition: stack.c:41
universe@390:
universe@390:
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
universe@390:
void * ucx_stack_calloc(UcxStack *stack, size_t nelem, size_t elsize)
Allocates an array of stack memory.
Definition: stack.c:73
universe@390:
char * top
Pointer to the top of the stack.
Definition: stack.h:63
universe@390:
UcxAllocator allocator
UcxAllocator based on this stack.
Definition: stack.h:54
universe@390: