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

Function heap_alloc

gl/lib/heap.c:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41/* Allocate memory for the heap. */
42
43struct heap *
44heap_alloc (int (*compare) (void const *, void const *), idx_t n_reserve)
45{
46 struct heap *heap = xmalloc (sizeof *heap);
47
48 if (n_reserve == 0)
49 n_reserve = 1;
50
51 heap->array = xnmalloc (n_reserve, sizeof *(heap->array));
52
53 heap->array[0] = NULL;
54 heap->capacity = n_reserve;
55 heap->count = 0;
56 heap->compare = compare ? compare : heap_default_compare;
57
58 return heap;
59}
60
61
62static int

Callers 1

queue_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected