Commit 6936c0e2 authored by Max Kellermann's avatar Max Kellermann

Queue: use std::swap

parent 10824204
......@@ -145,13 +145,10 @@ queue::Append(struct song *song, uint8_t priority)
void
queue::SwapPositions(unsigned position1, unsigned position2)
{
struct queue_item tmp;
unsigned id1 = items[position1].id;
unsigned id2 = items[position2].id;
tmp = items[position1];
items[position1] = items[position2];
items[position2] = tmp;
std::swap(items[position1], items[position2]);
items[position1].version = version;
items[position2].version = version;
......
......@@ -24,6 +24,8 @@
#include <glib.h>
#include <algorithm>
#include <assert.h>
#include <stdint.h>
......@@ -265,9 +267,7 @@ struct queue {
* Swaps two songs, addressed by their order number.
*/
void SwapOrders(unsigned order1, unsigned order2) {
unsigned tmp = order[order1];
order[order1] = order[order2];
order[order2] = tmp;
std::swap(order[order1], order[order2]);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment