Lines Matching refs:capacity

44 …line ds_priority_queue_node_t *reallocate_nodes(ds_priority_queue_node_t *nodes, uint32_t capacity)  in reallocate_nodes()  argument
46 return erealloc(nodes, capacity * sizeof(ds_priority_queue_node_t)); in reallocate_nodes()
49 static inline ds_priority_queue_node_t *allocate_nodes(uint32_t capacity) in allocate_nodes() argument
51 return ecalloc(capacity, sizeof(ds_priority_queue_node_t)); in allocate_nodes()
54 static inline void reallocate_to_capacity(ds_priority_queue_t *queue, uint32_t capacity) in reallocate_to_capacity() argument
56 queue->nodes = reallocate_nodes(queue->nodes, capacity); in reallocate_to_capacity()
57 queue->capacity = capacity; in reallocate_to_capacity()
62 reallocate_to_capacity(queue, queue->capacity * 2); in increase_capacity()
65 void ds_priority_queue_allocate(ds_priority_queue_t *queue, uint32_t capacity) in ds_priority_queue_allocate() argument
67 capacity = ds_priority_queue_get_capacity_for_size(capacity); in ds_priority_queue_allocate()
69 if (capacity > queue->capacity) { in ds_priority_queue_allocate()
70 reallocate_to_capacity(queue, capacity); in ds_priority_queue_allocate()
79 queue->capacity = DS_PRIORITY_QUEUE_MIN_CAPACITY; in ds_priority_queue()
88 return queue->capacity; in ds_priority_queue_capacity()
101 if (queue->size == queue->capacity) { in ds_priority_queue_push()
139 …if (queue->size <= (queue->capacity / 4) && (queue->capacity / 2) >= DS_PRIORITY_QUEUE_MIN_CAPACIT… in ds_priority_queue_compact()
140 reallocate_to_capacity(queue, queue->capacity / 2); in ds_priority_queue_compact()
200 ds_priority_queue_node_t *copies = allocate_nodes(queue->capacity); in copy_nodes()
219 clone->capacity = queue->capacity; in ds_priority_queue_clone()