From ad309cdeae3531abb14529d04fc43062a4385388 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Feb 2014 18:58:24 +0100 Subject: SongUpdate: make variables more local --- src/SongUpdate.cxx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/SongUpdate.cxx') diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index 665783279..04bab5d1e 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -44,21 +44,16 @@ Song * Song::LoadFile(const char *path_utf8, Directory &parent) { - Song *song; - bool ret; - assert(!uri_has_scheme(path_utf8)); assert(strchr(path_utf8, '\n') == nullptr); - song = NewFile(path_utf8, parent); + Song *song = NewFile(path_utf8, parent); //in archive ? - if (parent.device == DEVICE_INARCHIVE) { - ret = song->UpdateFileInArchive(); - } else { - ret = song->UpdateFile(); - } - if (!ret) { + bool success = parent.device == DEVICE_INARCHIVE + ? song->UpdateFileInArchive() + : song->UpdateFile(); + if (!success) { song->Free(); return nullptr; } -- cgit v1.2.3