Add queue_t

This commit is contained in:
2022-09-13 10:37:40 +03:00
parent 828fe1caac
commit c0294bc1f0
2 changed files with 106 additions and 0 deletions
+11
View File
@@ -12,6 +12,11 @@ typedef struct libcdsb_stack_node {
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);
@@ -19,6 +24,12 @@ 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__;