58 __sync_fetch_and_add(&queue->
ref_count, 1);
70 if (__sync_sub_and_fetch(&queue->
ref_count, 1))
85 queue =
new0(
struct queue, 1);
123 __sync_fetch_and_add(&entry->
ref_count, 1);
135 if (__sync_sub_and_fetch(&entry->
ref_count, 1))
238 for (tmp = queue->
head; tmp; tmp = tmp->
next) {
239 if (tmp->
data == entry) {
255 queue->
tail = new_entry;
257 qentry->
next = new_entry;
273 if (!queue || !queue->
head)
299 if (!queue || !queue->
head)
312 if (!queue || !queue->
tail)
330 if (!queue || !
function)
343 function(entry->
data, user_data);
377 const void *match_data)
387 for (entry = queue->
head; entry; entry = entry->
next)
388 if (
function(entry->
data, match_data))
409 for (entry = queue->
head, prev = NULL; entry;
410 prev = entry, entry = entry->
next) {
411 if (entry->
data != data)
445 if (!queue || !
function)
451 if (
function(entry->
data, user_data)) {
491 unsigned int count = 0;
501 unsigned int entries = queue->
entries;
void * queue_find(struct queue *queue, queue_match_func_t function, const void *match_data)
void queue_foreach(struct queue *queue, queue_foreach_func_t function, void *user_data)
const struct queue_entry * queue_get_entries(struct queue *queue)
static struct queue_entry * queue_entry_new(void *data)
static bool direct_match(const void *a, const void *b)
void(* queue_destroy_func_t)(void *data)
bool queue_push_after(struct queue *queue, void *entry, void *data)
void * queue_pop_head(struct queue *queue)
unsigned int queue_length(struct queue *queue)
struct queue_entry * head
static struct queue * queue_ref(struct queue *queue)
bool queue_isempty(struct queue *queue)
void queue_destroy(struct queue *queue, queue_destroy_func_t destroy)
void * queue_peek_head(struct queue *queue)
bool queue_push_tail(struct queue *queue, void *data)
struct queue * queue_new(void)
bool queue_remove(struct queue *queue, void *data)
unsigned int queue_remove_all(struct queue *queue, queue_match_func_t function, void *user_data, queue_destroy_func_t destroy)
static void queue_entry_unref(struct queue_entry *entry)
void(* queue_foreach_func_t)(void *data, void *user_data)
void * queue_peek_tail(struct queue *queue)
struct queue_entry * tail
void * queue_remove_if(struct queue *queue, queue_match_func_t function, void *user_data)
bool(* queue_match_func_t)(const void *data, const void *match_data)
struct queue_entry * next
static void queue_unref(struct queue *queue)
static struct queue_entry * queue_entry_ref(struct queue_entry *entry)
bool queue_push_head(struct queue *queue, void *data)