Use std::make_shared

This commit is contained in:
Jonas Kvinge
2021-06-30 16:14:58 +02:00
parent ffa2489998
commit f3a8dde5f0
6 changed files with 7 additions and 7 deletions

View File

@@ -199,7 +199,7 @@ QList<PlaylistItemPtr> PlaylistBackend::GetPlaylistItems(int playlist) {
if (db_->CheckErrors(q)) return QList<PlaylistItemPtr>();
// it's probable that we'll have a few songs associated with the same CUE so we're caching results of parsing CUEs
std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
std::shared_ptr<NewSongFromQueryState> state_ptr = std::make_shared<NewSongFromQueryState>();
while (q.next()) {
playlistitems << NewPlaylistItemFromQuery(SqlRow(q), state_ptr);
}
@@ -225,7 +225,7 @@ QList<Song> PlaylistBackend::GetPlaylistSongs(int playlist) {
if (db_->CheckErrors(q)) return QList<Song>();
// it's probable that we'll have a few songs associated with the same CUE so we're caching results of parsing CUEs
std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
std::shared_ptr<NewSongFromQueryState> state_ptr = std::make_shared<NewSongFromQueryState>();
while (q.next()) {
songs << NewSongFromQuery(SqlRow(q), state_ptr);
}