From 7e3e4194f34693b76763ca1db93aabbd319c367a Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 7 Sep 2016 09:21:31 -0400 Subject: [PATCH] core/queue: Remove Q_NO_SORT This flag was only used by the History playlist, but we have a noop function to handle this instead. Signed-off-by: Anna Schumaker --- core/playlists/system.c | 3 +-- core/queue.c | 2 -- include/core/queue.h | 4 ++-- tests/core/playlists/system.c | 2 -- tests/core/queue.c | 14 +------------- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/core/playlists/system.c b/core/playlists/system.c index 8a5a6a29..c04b82b3 100644 --- a/core/playlists/system.c +++ b/core/playlists/system.c @@ -229,8 +229,7 @@ static struct sys_playlist sys_collection = { static void sys_pl_history_init(struct playlist *playlist, unsigned int flags, struct queue_ops *ops) { - queue_init(&playlist->pl_queue, - Q_ENABLED | Q_REPEAT | Q_ADD_FRONT | Q_NO_SORT, + queue_init(&playlist->pl_queue, Q_ENABLED | Q_REPEAT | Q_ADD_FRONT, ops, playlist); } diff --git a/core/queue.c b/core/queue.c index b9dd5647..a05eed29 100644 --- a/core/queue.c +++ b/core/queue.c @@ -365,8 +365,6 @@ void queue_sort(struct queue *queue, enum compare_t sort, bool reset) GSList *cur = NULL; int field; - if (queue_has_flag(queue, Q_NO_SORT)) - return; if (reset) { g_slist_free(queue->q_sort); queue->q_sort = NULL; diff --git a/include/core/queue.h b/include/core/queue.h index 393dcfbd..5f22f528 100644 --- a/include/core/queue.h +++ b/include/core/queue.h @@ -18,13 +18,13 @@ enum queue_flags { Q_ENABLED = (1 << 0), /* Queue is enabled. */ Q_RANDOM = (1 << 1), /* Queue will pick songs randomly. */ Q_REPEAT = (1 << 2), /* Queue will not remove songs when picked. */ - Q_NO_SORT = (1 << 3), /* Queue will not be sorted. */ + Q_UNUSED_3 = (1 << 3), /* Removed: 6.5.4 */ Q_UNUSED_4 = (1 << 4), /* Removed: 6.5.4 */ Q_UNUSED_5 = (1 << 5), /* Removed: 6.5.4 */ Q_ADD_FRONT = (1 << 6), /* Queue will add new tracks at the front. */ }; -#define Q_UNUSED_MASK (~(Q_UNUSED_4 | Q_UNUSED_5)) +#define Q_UNUSED_MASK (~(Q_UNUSED_3 | Q_UNUSED_4 | Q_UNUSED_5)) struct queue_ops { diff --git a/tests/core/playlists/system.c b/tests/core/playlists/system.c index 2d334715..5080f7c0 100644 --- a/tests/core/playlists/system.c +++ b/tests/core/playlists/system.c @@ -173,7 +173,6 @@ static void test_queued() g_assert_nonnull(queue); g_assert_false(queue_has_flag(queue, Q_ADD_FRONT)); - g_assert_false(queue_has_flag(queue, Q_NO_SORT)); g_assert_false(queue_has_flag(queue, Q_REPEAT)); g_assert_cmpuint(g_slist_length(queue->q_sort), ==, 0); @@ -232,7 +231,6 @@ static void test_history() g_assert_nonnull(queue); g_assert_true(queue_has_flag(queue, Q_ADD_FRONT)); - g_assert_true(queue_has_flag(queue, Q_NO_SORT)); g_assert_true(queue_has_flag(queue, Q_REPEAT)); __test_playlist_id("History", SYS_PL_HISTORY); __test_playlist_noselect("History"); diff --git a/tests/core/queue.c b/tests/core/queue.c index e6d4e7f1..dc500f8a 100644 --- a/tests/core/queue.c +++ b/tests/core/queue.c @@ -115,7 +115,7 @@ static void test_flags() g_assert_false(queue_has_flag(&q, Q_ENABLED)); g_assert_false(queue_has_flag(&q, Q_RANDOM)); g_assert_false(queue_has_flag(&q, Q_REPEAT)); - g_assert_false(queue_has_flag(&q, Q_NO_SORT)); + g_assert_false(queue_has_flag(&q, Q_UNUSED_3)); g_assert_false(queue_has_flag(&q, Q_UNUSED_4)); g_assert_false(queue_has_flag(&q, Q_UNUSED_5)); g_assert_false(queue_has_flag(&q, Q_ADD_FRONT)); @@ -129,18 +129,15 @@ static void test_flags() queue_set_flag(&q, Q_ENABLED); queue_set_flag(&q, Q_RANDOM); queue_set_flag(&q, Q_REPEAT); - queue_set_flag(&q, Q_NO_SORT); queue_set_flag(&q, Q_ADD_FRONT); g_assert_true(queue_has_flag(&q, Q_ENABLED)); g_assert_true(queue_has_flag(&q, Q_RANDOM)); g_assert_true(queue_has_flag(&q, Q_REPEAT)); - g_assert_true(queue_has_flag(&q, Q_NO_SORT)); g_assert_true(queue_has_flag(&q, Q_ADD_FRONT)); queue_unset_flag(&q, Q_ENABLED); queue_unset_flag(&q, Q_RANDOM); queue_unset_flag(&q, Q_REPEAT); - queue_unset_flag(&q, Q_NO_SORT); queue_unset_flag(&q, Q_ADD_FRONT); g_assert_cmpuint(q.q_flags, ==, 0); } @@ -386,15 +383,6 @@ static void test_sorting() g_assert_cmpuint(track->tr_track, ==, ex_count[i]); } - queue_set_flag(&q, Q_NO_SORT); - queue_sort(&q, COMPARE_TITLE, true); - for (i = 0; i < 13; i++) { - track = queue_at(&q, i); - g_assert_nonnull(track); - g_assert_cmpuint(track->tr_track, ==, ex_count[i]); - } - - queue_unset_flag(&q, Q_NO_SORT); queue_sort(&q, COMPARE_TITLE, true); for (i = 0; i < 13; i++) { track = queue_at(&q, i);