/* Copyright (c) 2008-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "priorityq.h"
/* Macros for moving inside an array implementation of binary tree where
[0] is the root. */
struct priorityq {
};
struct priorityq *
{
return pq;
}
{
}
{
}
{
/* swap the item indexes */
/* swap the item pointers */
}
static unsigned int
{
while (idx > 0) {
break;
/* wrong order - swap */
idx = parent_idx;
}
return idx;
}
{
else
break;
/* wrong order - swap */
idx = min_child_idx;
}
}
{
}
{
unsigned int count;
/* move last item over the removed one and fix the heap */
count--;
if (idx > 0)
}
}
{
}
{
return NULL;
return items[0];
}
{
priorityq_remove_idx(pq, 0);
}
return item;
}
{
return NULL;
}