lib/heap.c
/* Inserts 'node' into 'heap' with the specified 'priority', without
 * maintaining the heap invariant.
 *
 * After this call, heap_max() will no longer necessarily return the maximum
 * value in the heap, and HEAP_FOR_EACH will no longer necessarily iterate in
 * heap level order, until the next call to heap_rebuild(heap).
 *
 * This takes time O(1). */


After this call, heap_max() will no longer necessarily return the maximum
value in the heap, and HEAP_FOR_EACH will no longer necessarily iterate in
heap level order, until the next call to heap_rebuild(heap).


After this call heap_max () will no longer necessarily return the maximum value in the heap and HEAP_FOR_EACH will no longer necessarily iterate in heap level order until the next call to heap_rebuild ( heap ) .
void
heap_raw_insert(struct heap *heap, struct heap_node *node, uint64_t priority)
{
    if (heap->n >= heap->allocated) {
        heap->allocated = heap->n == 0 ? 1 : 2 * heap->n;
        heap->array = xrealloc(heap->array,
                               (heap->allocated + 1) * sizeof *heap->array);
    }
    put_node(heap, node, ++heap->n);
    node->priority = priority;
}
void heap_raw_insert ( struct heap * heap , struct heap_node * node , uint64_t priority ) { if ( heap -> n >= heap -> allocated ) { heap -> allocated = heap -> n == 0 ? 1 : 2 * heap -> n ; heap -> array = xrealloc ( heap -> array , ( heap -> allocated + 1 ) * sizeof * heap -> array ) ; } put_node ( heap , node , ++ heap -> n ) ; node -> priority = priority ; }
Inserts 'node' into 'heap' with the specified 'priority', without
 maintaining the heap invariant.
Inserts ' node ' into ' heap ' with the specified ' priority ' without maintaining the heap invariant .