From b919843717d580242c341f4598a0938872a27e83 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 14 Dec 2015 10:56:39 -0500 Subject: [PATCH] core/tempq: Add tempq_deinit() function Signed-off-by: Anna Schumaker --- core/core.cpp | 1 + core/deck.cpp | 6 ++++++ include/core/deck.h | 3 +++ tests/core/deck.cpp | 1 + 4 files changed, 11 insertions(+) diff --git a/core/core.cpp b/core/core.cpp index 4416faa4..c87e9be0 100644 --- a/core/core.cpp +++ b/core/core.cpp @@ -26,6 +26,7 @@ void core :: init(struct core_init_data *init) void core :: deinit() { + tempq_deinit(); history_deinit(); collection_deinit(); playlist_deinit(); diff --git a/core/deck.cpp b/core/deck.cpp index 31b9297c..53957be8 100644 --- a/core/deck.cpp +++ b/core/deck.cpp @@ -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; diff --git a/include/core/deck.h b/include/core/deck.h index d3abeb94..1f41d5f6 100644 --- a/include/core/deck.h +++ b/include/core/deck.h @@ -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); diff --git a/tests/core/deck.cpp b/tests/core/deck.cpp index ababcf21..ae5da85c 100644 --- a/tests/core/deck.cpp +++ b/tests/core/deck.cpp @@ -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();