| 91 | /* Pop top element off heap. */ |
| 92 | |
| 93 | void * |
| 94 | heap_remove_top (struct heap *heap) |
| 95 | { |
| 96 | void *top; |
| 97 | |
| 98 | if (heap->count == 0) |
| 99 | return NULL; |
| 100 | |
| 101 | top = heap->array[1]; |
| 102 | heap->array[1] = heap->array[heap->count--]; |
| 103 | heapify_down (heap->array, heap->count, 1, heap->compare); |
| 104 | |
| 105 | return top; |
| 106 | } |
| 107 | |
| 108 | /* Move element down into appropriate position in heap. */ |
| 109 |
no test coverage detected