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:
Anna Schumaker 2016-09-03 12:01:27 -04:00
parent f147c30c30
commit d373c55320
2 changed files with 15 additions and 0 deletions

View File

@ -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;

View File

@ -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);