6#define MIN(a, b) (a < b ? a : b)
7#define MAX(a, b) (a > b ? a : b)
16 queue->
data = malloc(
sizeof(
int) * max_length);
63 *item = queue->
data[index];
int cqueue_isfull(const cqueue_t *queue)
Check if the given circular queue is full.
void cqueue_close(cqueue_t *queue)
Close the given circular queue.
error_code_t cqueue_add(cqueue_t *queue, int item)
Add a value to the circular queue.
error_code_t cqueue_get(cqueue_t *queue, int *item)
Get the current value from the circular queue, removing it from the queue.
error_code_t cqueue_lookup(const cqueue_t *queue, int *item, unsigned int seek)
Get a value from the circular queue, without removing it from the queue.
void cqueue_init(cqueue_t *queue, unsigned int max_length)
Initializes a circular queue.
int cqueue_isempty(const cqueue_t *queue)
Check if the given circular queue is empty.
enum error_code error_code_t
Enumeration of error codes.
int _current
The index for the current item.
unsigned int _max_length
The maximum number of items that fits on the queue.
int _last
The index of the last item.
int * data
Pointer to queue data with allocated space to fit max_size items.
unsigned int length
The current number of items on the queue.
struct cqueue cqueue_t
Circular queue of integers.