mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 15:33:34 +00:00
Merge pull request #374 from qlyoung/pqueue-linear-remove
lib: add removal by item to pqueue
This commit is contained in:
commit
ae73184340
@ -188,3 +188,11 @@ pqueue_remove_at (int index, struct pqueue *queue)
|
||||
trickle_down (index, queue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pqueue_remove (void *data, struct pqueue *queue)
|
||||
{
|
||||
for (int i = 0; i < queue->size; i++)
|
||||
if (queue->array[i] == data)
|
||||
pqueue_remove_at (i, queue);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ extern void pqueue_delete (struct pqueue *queue);
|
||||
extern void pqueue_enqueue (void *data, struct pqueue *queue);
|
||||
extern void *pqueue_dequeue (struct pqueue *queue);
|
||||
extern void pqueue_remove_at (int index, struct pqueue *queue);
|
||||
extern void pqueue_remove (void *data, struct pqueue *queue);
|
||||
|
||||
extern void trickle_down (int index, struct pqueue *queue);
|
||||
extern void trickle_up (int index, struct pqueue *queue);
|
||||
|
Loading…
Reference in New Issue
Block a user