- else if (del_node == root->root)
- return GNUNET_CONTAINER_heap_remove_root (root);
-
- ret = del_node->element;
- last = getPos (root, root->size);
-
- old_cost = del_node->cost;
- del_node->element = last->element;
- del_node->cost = last->cost;
-
- if (last->parent->left_child == last)
- last->parent->left_child = NULL;
- if (last->parent->right_child == last)
- last->parent->right_child = NULL;
-
- if (root->traversal_pos == last)
- {
- root->traversal_pos = root->root;
- }
- GNUNET_free (last);
- root->size--;
-
- if (del_node->cost > old_cost)
- {
- if (root->type == GNUNET_CONTAINER_HEAP_ORDER_MAX)
- percolateHeap (del_node, root);
- else if (root->type == GNUNET_CONTAINER_HEAP_ORDER_MIN)
- percolateDownHeap (del_node, root);
- }
- else if (del_node->cost < old_cost)