-
Notifications
You must be signed in to change notification settings - Fork 11
/
linked_list_queue.h
59 lines (47 loc) · 1.06 KB
/
linked_list_queue.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef LINKED_LIST_QUEUE_H
#define LINKED_LIST_QUEUE_H
typedef struct llqnode_s llqnode_t;
struct llqnode_s
{
llqnode_t *next;
void *item;
};
typedef struct
{
llqnode_t *head, *tail;
int count;
} linked_list_queue_t;
void *llqueue_new(
);
void llqueue_free(
linked_list_queue_t * qu
);
void *llqueue_poll(
linked_list_queue_t * qu
);
void llqueue_offer(
linked_list_queue_t * qu,
void *item
);
/**
* remove this item, by comparing the memory address of the item */
void *llqueue_remove_item(
linked_list_queue_t * qu,
const void *item
);
int llqueue_count(
const linked_list_queue_t * qu
);
/**
* remove this item, by using the supplied compare function */
void *llqueue_remove_item_via_cmpfunction(
linked_list_queue_t * qu,
const void *item,
int (*cmp)(const void*, const void*));
/**
* get this item, by using the supplied compare function */
void *llqueue_get_item_via_cmpfunction(
linked_list_queue_t * qu,
const void *item,
long (*cmp)(const void*, const void*));
#endif /* LINKED_LIST_QUEUE_H */