core/queue: Add a queue_erase_track() function
Used to trigger the erase callback on tracks, rather than indexes. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
f147c30c30
commit
d373c55320
12
core/queue.c
12
core/queue.c
|
@ -257,6 +257,18 @@ void queue_erase(struct queue *queue, unsigned int index)
|
|||
__queue_remove(queue, &it);
|
||||
}
|
||||
|
||||
void queue_erase_track(struct queue *queue, struct track *track)
|
||||
{
|
||||
struct queue_iter it;
|
||||
|
||||
queue_for_each(queue, &it) {
|
||||
if (queue_iter_val(&it) == track) {
|
||||
queue_erase(queue, it.it_pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void queue_remove(struct queue *queue, unsigned int index)
|
||||
{
|
||||
struct queue_iter it;
|
||||
|
|
|
@ -165,6 +165,9 @@ unsigned int queue_add(struct queue *, struct track *);
|
|||
*/
|
||||
void queue_erase(struct queue *, unsigned int);
|
||||
|
||||
/* Called to erase a track from the queue */
|
||||
void queue_erase_track(struct queue *, struct track *);
|
||||
|
||||
/* Called to remove a track from the queue by index. */
|
||||
void queue_remove(struct queue *, unsigned int);
|
||||
|
||||
|
|
Loading…
Reference in New Issue