core/tempq: Add tempq_deinit() function

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-12-14 10:56:39 -05:00
parent b3d95a06d4
commit b919843717
4 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,7 @@ void core :: init(struct core_init_data *init)
void core :: deinit()
{
tempq_deinit();
history_deinit();
collection_deinit();
playlist_deinit();

View File

@ -82,6 +82,12 @@ void tempq_init(struct queue_ops *ops)
file_close(&deck_file);
}
void tempq_deinit()
{
while (queue_deck.size() > 0)
queue_deck.erase(queue_deck.begin());
}
struct queue *tempq_alloc(struct queue_ops *ops, unsigned int flags)
{
struct queue *queue;

View File

@ -52,6 +52,9 @@ namespace deck
/* Called to initialize the temporary queue manager. */
void tempq_init(struct queue_ops *);
/* Called to deinitialize the temporary queue manager. */
void tempq_deinit();
/* Called to allocate a new temporary queue. */
struct queue *tempq_alloc(struct queue_ops *, unsigned int);

View File

@ -101,6 +101,7 @@ static void test_next()
test_equal(tempq_get(0), NULL);
test_equal(tempq_count(), 0);
tempq_deinit();
history_deinit();
collection_deinit();
playlist_deinit();