ocarina/core/queue.c
Anna Schumaker 03e7346900 core/playlist: Move current track into the playlist struct
I keep using the queue_iter struct for now to reduce code churn in this
patch.  I'll be replacing it in the next patch.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2017-05-13 08:45:04 -04:00

34 lines
668 B
C

/*
* Copyright 2013 (c) Anna Schumaker.
*/
#include <core/queue.h>
#include <core/string.h>
#include <stdlib.h>
static inline void *__queue_init(struct queue *queue, void *data)
{
if (queue->q_ops)
return queue->q_ops->qop_init(queue, data);
return NULL;
}
static inline void __queue_deinit(struct queue *queue)
{
if (queue->q_ops)
queue->q_ops->qop_deinit(queue);
}
void queue_init(struct queue *queue, const struct queue_ops *ops, void *data)
{
queue->q_ops = ops;
g_queue_init(&queue->q_tracks);
queue->q_private = __queue_init(queue, data);
}
void queue_deinit(struct queue *queue)
{
g_queue_clear(&queue->q_tracks);
__queue_deinit(queue);
}