diff options
Diffstat (limited to 'src/Queue.cxx')
-rw-r--r-- | src/Queue.cxx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/Queue.cxx b/src/Queue.cxx index 451609438..116fcead1 100644 --- a/src/Queue.cxx +++ b/src/Queue.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,9 +19,7 @@ #include "config.h" #include "Queue.hxx" -#include "Song.hxx" - -#include <stdlib.h> +#include "DetachedSong.hxx" queue::queue(unsigned _max_length) :max_length(_max_length), length(0), @@ -86,7 +84,7 @@ queue::ModifyAtOrder(unsigned _order) } unsigned -queue::Append(Song *song, uint8_t priority) +queue::Append(DetachedSong &&song, uint8_t priority) { assert(!IsFull()); @@ -94,7 +92,7 @@ queue::Append(Song *song, uint8_t priority) const unsigned id = id_table.Insert(position); auto &item = items[position]; - item.song = song->DupDetached(); + item.song = new DetachedSong(std::move(song)); item.id = id; item.version = version; item.priority = priority; @@ -221,11 +219,7 @@ queue::DeletePosition(unsigned position) { assert(position < length); - { - Song &song = Get(position); - assert(!song.IsInDatabase() || song.IsDetached()); - song.Free(); - } + delete items[position].song; const unsigned id = PositionToId(position); const unsigned _order = PositionToOrder(position); @@ -259,9 +253,7 @@ queue::Clear() for (unsigned i = 0; i < length; i++) { Item *item = &items[i]; - assert(!item->song->IsInDatabase() || - item->song->IsDetached()); - item->song->Free(); + delete item->song; id_table.Erase(item->id); } |