-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
28 lines (23 loc) · 696 Bytes
/
queue.h
File metadata and controls
28 lines (23 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef QUEUE_H_
#define QUEUE_H_
#include <stdbool.h>
typedef struct queueNode {
void *item;
struct queueNode *next;
} QueueNode;
typedef struct queue {
QueueNode *front;
QueueNode *rear;
unsigned int len;
size_t itemSize;
bool (* free)(void *item);
} Queue;
bool InitQueue(Queue **queue, size_t itemSize, bool (* free)(void *item));
bool FreeQueue(Queue *queue);
bool ResetQueue(Queue *queue);
bool MakeQueueNode(QueueNode **node, void *item);
bool FreeQueueNode(QueueNode *node);
bool PushQueueItem(Queue *queue, void *item);
bool PopQueueItem(Queue *queue, void * restrict item);
bool TraverseQueueItem(Queue *queue, bool (* invoke)(const void *item));
#endif