aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-07 21:17:01 +0100
committerMax Kellermann <max@duempel.org>2013-01-07 21:17:01 +0100
commit2b8ce83c9b5963706d2729334add71251fa32b79 (patch)
tree4ed6f5719d4703126b5c1e0bbae0bda269341ec7 /src
parent52638c68f51209dc6c5a966feeadffc5b922f919 (diff)
downloadmpd-2b8ce83c9b5963706d2729334add71251fa32b79.tar.gz
mpd-2b8ce83c9b5963706d2729334add71251fa32b79.tar.xz
mpd-2b8ce83c9b5963706d2729334add71251fa32b79.zip
Queue: move queue_shuffle_order_range() into the class
Diffstat (limited to '')
-rw-r--r--src/Queue.cxx19
-rw-r--r--src/Queue.hxx6
2 files changed, 13 insertions, 12 deletions
diff --git a/src/Queue.cxx b/src/Queue.cxx
index 1b329e485..608cb1736 100644
--- a/src/Queue.cxx
+++ b/src/Queue.cxx
@@ -368,20 +368,15 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end)
queue);
}
-/**
- * Shuffle the order of items in the specified range, ignoring their
- * priorities.
- */
-static void
-queue_shuffle_order_range(struct queue *queue, unsigned start, unsigned end)
+void
+queue::ShuffleOrderRange(unsigned start, unsigned end)
{
- assert(queue != NULL);
- assert(queue->random);
+ assert(random);
assert(start <= end);
- assert(end <= queue->length);
+ assert(end <= length);
for (unsigned i = start; i < end; ++i)
- queue->SwapOrders(i, g_rand_int_range(queue->rand, i, end));
+ SwapOrders(i, g_rand_int_range(rand, i, end));
}
/**
@@ -412,14 +407,14 @@ queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end)
if (priority != group_priority) {
/* start of a new group - shuffle the one that
has just ended */
- queue_shuffle_order_range(this, group_start, i);
+ ShuffleOrderRange(group_start, i);
group_start = i;
group_priority = priority;
}
}
/* shuffle the last group */
- queue_shuffle_order_range(this, group_start, end);
+ ShuffleOrderRange(group_start, end);
}
void
diff --git a/src/Queue.hxx b/src/Queue.hxx
index f52dd3335..0652c711f 100644
--- a/src/Queue.hxx
+++ b/src/Queue.hxx
@@ -299,6 +299,12 @@ struct queue {
}
/**
+ * Shuffle the order of items in the specified range, ignoring
+ * their priorities.
+ */
+ void ShuffleOrderRange(unsigned start, unsigned end);
+
+ /**
* Shuffle the order of items in the specified range, taking their
* priorities into account.
*/