26 #include "my_global.h"
39 int (*compare)(
void *, uchar *,uchar *);
43 #define queue_top(queue) ((queue)->root[1])
44 #define queue_element(queue,index) ((queue)->root[index+1])
45 #define queue_end(queue) ((queue)->root[(queue)->elements])
46 #define queue_replaced(queue) _downheap(queue,1)
47 #define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
48 #define queue_set_max_at_top(queue, set_arg) \
49 (queue)->max_at_top= set_arg ? -1 : 1
50 typedef int (*queue_compare)(
void *,uchar *, uchar *);
52 int init_queue(
QUEUE *queue,uint max_elements,uint offset_to_key,
53 pbool max_at_top, queue_compare
compare,
55 int init_queue_ex(
QUEUE *queue,uint max_elements,uint offset_to_key,
56 pbool max_at_top, queue_compare
compare,
57 void *first_cmp_arg, uint auto_extent);
58 int reinit_queue(
QUEUE *queue,uint max_elements,uint offset_to_key,
59 pbool max_at_top, queue_compare
compare,
61 int resize_queue(
QUEUE *queue, uint max_elements);
62 void delete_queue(
QUEUE *queue);
63 void queue_insert(
QUEUE *queue,uchar *element);
64 int queue_insert_safe(
QUEUE *queue, uchar *element);
65 uchar *queue_remove(
QUEUE *queue,uint idx);
66 #define queue_remove_all(queue) { (queue)->elements= 0; }
67 #define queue_is_full(queue) (queue->elements == queue->max_elements)
68 void _downheap(
QUEUE *queue,uint idx);
69 void queue_fix(
QUEUE *queue);
70 #define is_queue_inited(queue) ((queue)->root != 0)