sticker/Database: return Sticker by value

This commit is contained in:
Max Kellermann
2019-04-24 15:05:05 +02:00
parent 7b48ae4f85
commit 5a915eb0e6
5 changed files with 13 additions and 32 deletions

View File

@@ -21,6 +21,7 @@
#include "Request.hxx"
#include "SongPrint.hxx"
#include "db/Interface.hxx"
#include "sticker/Sticker.hxx"
#include "sticker/SongSticker.hxx"
#include "sticker/StickerPrint.hxx"
#include "sticker/StickerDatabase.hxx"
@@ -76,11 +77,8 @@ handle_sticker_song(Response &r, Partition &partition, Request args)
assert(song != nullptr);
AtScopeExit(&db, song) { db.ReturnSong(song); };
Sticker *sticker = sticker_song_get(*song);
if (sticker) {
sticker_print(r, *sticker);
sticker_free(sticker);
}
const auto sticker = sticker_song_get(*song);
sticker_print(r, sticker);
return CommandResult::OK;
/* set song song_id id key */