MCPcopy Create free account
hub / github.com/coreutils/coreutils / heap_remove_top

Function heap_remove_top

gl/lib/heap.c:93–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91/* Pop top element off heap. */
92
93void *
94heap_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

Callers 1

queue_popFunction · 0.85

Calls 1

heapify_downFunction · 0.85

Tested by

no test coverage detected