51 |
typedef long int prio_t; |
typedef long int prio_t; |
52 |
|
|
53 |
/* Priority queue node */ |
/* Priority queue node */ |
54 |
|
/* Data structs added with pq_add() must have a prio_t as the first field */ |
55 |
typedef struct { |
typedef struct { |
56 |
prio_t pri; /* priority */ |
prio_t pri; /* priority */ |
|
void * data; /* data */ |
|
57 |
} pq_node; |
} pq_node; |
58 |
|
|
59 |
/* Priority queue struct */ |
/* Priority queue struct */ |
66 |
|
|
67 |
|
|
68 |
extern int pq_new(pqueue *,int,int(*)(void*,void*)); |
extern int pq_new(pqueue *,int,int(*)(void*,void*)); |
69 |
extern prio_t pq_add(prio_t,void *,pqueue *); |
extern prio_t pq_add(void *,pqueue *); |
70 |
extern void * pq_min(pqueue *); |
extern void * pq_min(pqueue *); |
71 |
extern void * pq_del_min(pqueue *); |
extern void * pq_del_min(pqueue *); |
72 |
extern int pq_empty(pqueue *); |
extern int pq_empty(pqueue *); |