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 60
|
#ifndef PRIO_QUEUE_H
#define PRIO_QUEUE_H
typedef int (*prio_queue_compare_fn)(const void *one, const void *two, void *cb_data);
struct prio_queue_entry {
size_t ctr;
void *data;
};
struct prio_queue {
prio_queue_compare_fn compare;
size_t insertion_ctr;
void *cb_data;
size_t alloc, nr;
struct prio_queue_entry *array;
};
void prio_queue_put(struct prio_queue *, void *thing);
void *prio_queue_get(struct prio_queue *);
void *prio_queue_peek(struct prio_queue *);
void clear_prio_queue(struct prio_queue *);
void prio_queue_reverse(struct prio_queue *);
#endif
|