1
0
mirror of https://github.com/jrcutler/threadless.io.git synced 2024-07-07 10:35:49 +00:00

Add heap_replace() functionality

This commit is contained in:
2016-04-09 11:39:19 -04:00
parent ecf9cc606c
commit aca3db2b06
3 changed files with 42 additions and 2 deletions

View File

@ -84,6 +84,15 @@ static inline heap_node_t *heap_peek(const heap_t *heap)
*/
int heap_push(heap_t *heap, heap_node_t *node);
/** Replace an existing @p old node in a heap with a new @p node
* @param[in,out] old old node
* @param[in,out] node new node
* @pre @p old must be in a heap
* @post @p old is no longer in a heap
* @post @p node is in the heap that previously contained @p old
*/
void heap_replace(heap_node_t *old, heap_node_t *node);
/** Remove an arbitrary @p node from its heap
* @param[in,out] node node
* @pre @p node must be in a heap