/* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include #include "__attributes.h" #ifndef LIBCDSB_BITS_MEMORY_H #define LIBCDSB_BITS_MEMORY_H typedef struct libcdsb_stack_node { struct libcdsb_stack_node* prev; void* value; } stack_t; typedef struct libcdsb_queue { struct libcdsb_stack_node* back; struct libcdsb_stack_node* front; } queue_t; extern void libcdsb_stack_init (stack_t* stack) Nonnull__(1); extern void libcdsb_stack_push (stack_t* stack, void* value) Nonnull__(1); extern void libcdsb_stack_push_many(stack_t* stack, size_t n, ...) Nonnull__(1); extern void* libcdsb_stack_pop (stack_t* stack) Nonnull__(1); extern void libcdsb_stack_reverse (stack_t* stack) Nonnull__(1); extern void libcdsb_stack_flush (stack_t* stack) Nonnull__(1); extern void libcdsb_queue_init (queue_t* queue) Nonnull__(1); extern void libcdsb_queue_push (queue_t* queue, void* value) Nonnull__(1); extern void libcdsb_queue_push_many(queue_t* queue, size_t n, ...) Nonnull__(1); extern void* libcdsb_queue_pop (queue_t* queue) Nonnull__(1); extern void libcdsb_queue_flush (queue_t* queue) Nonnull__(1); extern void* libcdsb_aalloc (size_t a, size_t n) Warn_unused_result__; extern void* libcdsb_malloc (size_t n) Warn_unused_result__; extern void* libcdsb_calloc (size_t n, size_t c) Warn_unused_result__; extern void* libcdsb_realloc(void *p, size_t n) Warn_unused_result__; extern void libcdsb_free(void* s); #endif /* LIBCDSB_BITS_MEMORY_H */