MCPcopy Index your code
hub / github.com/git/git / prio_queue_put

Function prio_queue_put

prio-queue.c:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void prio_queue_put(struct prio_queue *queue, void *thing)
40{
41 size_t ix, parent;
42
43 /* Append at the end */
44 ALLOC_GROW(queue->array, queue->nr + 1, queue->alloc);
45 queue->array[queue->nr].ctr = queue->insertion_ctr++;
46 queue->array[queue->nr].data = thing;
47 queue->nr++;
48 if (!queue->compare)
49 return; /* LIFO */
50
51 /* Bubble up the new one */
52 for (ix = queue->nr - 1; ix; ix = parent) {
53 parent = (ix - 1) / 2;
54 if (compare(queue, parent, ix) <= 0)
55 break;
56
57 swap(queue, parent, ix);
58 }
59}
60
61static void sift_down_root(struct prio_queue *queue)
62{

Callers 15

mark_completeFunction · 0.85
nonstale_queue_putFunction · 0.85
get_reachable_subsetFunction · 0.85
get_branch_base_for_tipFunction · 0.85
queue_blamesFunction · 0.85
process_parentsFunction · 0.85
limit_listFunction · 0.85
test_flag_and_insertFunction · 0.85
init_topo_walkFunction · 0.85
expand_topo_walkFunction · 0.85

Calls 2

swapFunction · 0.85
compareFunction · 0.70

Tested by 2

test_flag_and_insertFunction · 0.68
test_prio_queueFunction · 0.68