g_assert (heap != NULL);
g_assert (elt->idx > 0 && elt->idx <= heap->ar->len);
-
oldpri = elt->pri;
elt->pri = npri;
}
}
+void
+rspamd_min_heap_remove_elt (struct rspamd_min_heap *heap,
+ struct rspamd_min_heap_elt *elt)
+{
+ struct rspamd_min_heap_elt *first;
+
+ g_assert (heap != NULL);
+ g_assert (elt->idx > 0 && elt->idx <= heap->ar->len);
+
+ first = g_ptr_array_index (heap->ar, 0);
+
+ if (elt != first) {
+ elt->pri = first->pri - 1;
+ rspamd_min_heap_swim (heap, elt);
+ }
+
+ /* Now the desired element is on the top of queue */
+ (void)rspamd_min_heap_pop (heap);
+}
+
void
rspamd_min_heap_destroy (struct rspamd_min_heap *heap)
{
void rspamd_min_heap_update_elt (struct rspamd_min_heap *heap,
struct rspamd_min_heap_elt *elt, guint npri);
+
+/**
+ * Removes element from the heap
+ * @param heap
+ * @param elt
+ */
+void rspamd_min_heap_remove_elt (struct rspamd_min_heap *heap,
+ struct rspamd_min_heap_elt *elt);
+
/**
* Destroys heap (elements are not destroyed themselves)
* @param heap