Lines Matching refs:q

15 	queue_t q;  in queue_create()  local
17 q = (queue_t) malloc(sizeof(struct queue_info)); in queue_create()
18 if (q == NULL) in queue_create()
21 q->head = q->tail = NULL; in queue_create()
23 return q; in queue_create()
26 int queue_insert(queue_t q, queue_element_t e) in queue_insert() argument
30 if (!q) in queue_insert()
40 if (q->head == NULL) { in queue_insert()
41 q->head = q->tail = newnode; in queue_insert()
43 q->tail->next = newnode; in queue_insert()
44 q->tail = newnode; in queue_insert()
50 int queue_push(queue_t q, queue_element_t e) in queue_push() argument
54 if (!q) in queue_push()
64 if (q->head == NULL) { in queue_push()
65 q->head = q->tail = newnode; in queue_push()
67 newnode->next = q->head; in queue_push()
68 q->head = newnode; in queue_push()
74 queue_element_t queue_remove(queue_t q) in queue_remove() argument
79 if (!q) in queue_remove()
82 if (q->head == NULL) in queue_remove()
85 node = q->head; in queue_remove()
86 q->head = q->head->next; in queue_remove()
87 if (q->head == NULL) in queue_remove()
88 q->tail = NULL; in queue_remove()
96 queue_element_t queue_head(queue_t q) in queue_head() argument
98 if (!q) in queue_head()
101 if (q->head == NULL) in queue_head()
104 return q->head->element; in queue_head()
107 void queue_destroy(queue_t q) in queue_destroy() argument
111 if (!q) in queue_destroy()
114 p = q->head; in queue_destroy()
122 free(q); in queue_destroy()
125 int queue_map(queue_t q, int (*f) (queue_element_t, void *), void *vp) in queue_map() argument
130 if (!q) in queue_map()
133 p = q->head; in queue_map()
143 void queue_map_remove_on_error(queue_t q, in queue_map_remove_on_error() argument
150 if (!q) in queue_map_remove_on_error()
154 p = q->head; in queue_map_remove_on_error()
161 q->tail = last; in queue_map_remove_on_error()
163 q->head = p->next; in queue_map_remove_on_error()
164 if (q->head == NULL) in queue_map_remove_on_error()
165 q->tail = NULL; in queue_map_remove_on_error()