command/other: use if-with-initializer
This commit is contained in:
parent
661aee29da
commit
352c598916
@ -169,8 +169,8 @@ static CommandResult
|
|||||||
handle_lsinfo_relative(Client &client, Response &r, const char *uri)
|
handle_lsinfo_relative(Client &client, Response &r, const char *uri)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
CommandResult result = handle_lsinfo2(client, uri, r);
|
if (CommandResult result = handle_lsinfo2(client, uri, r);
|
||||||
if (result != CommandResult::OK)
|
result != CommandResult::OK)
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
(void)client;
|
(void)client;
|
||||||
@ -290,12 +290,10 @@ handle_update(Client &client, Request args, Response &r, bool discard)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateService *update = client.GetInstance().update;
|
if (auto *update = client.GetInstance().update)
|
||||||
if (update != nullptr)
|
|
||||||
return handle_update(r, *update, path, discard);
|
return handle_update(r, *update, path, discard);
|
||||||
|
|
||||||
Database *db = client.GetInstance().GetDatabase();
|
if (auto *db = client.GetInstance().GetDatabase())
|
||||||
if (db != nullptr)
|
|
||||||
return handle_update(r, *db, path, discard);
|
return handle_update(r, *db, path, discard);
|
||||||
#else
|
#else
|
||||||
(void)client;
|
(void)client;
|
||||||
@ -388,15 +386,13 @@ handle_config(Client &client, [[maybe_unused]] Request args, Response &r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
const Storage *storage = client.GetStorage();
|
if (const Storage *storage = client.GetStorage()) {
|
||||||
if (storage != nullptr) {
|
|
||||||
const auto path = storage->MapUTF8("");
|
const auto path = storage->MapUTF8("");
|
||||||
r.Fmt(FMT_STRING("music_directory: {}\n"), path);
|
r.Fmt(FMT_STRING("music_directory: {}\n"), path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto spl_path = map_spl_path();
|
if (const auto spl_path = map_spl_path(); !spl_path.IsNull())
|
||||||
if (!spl_path.IsNull())
|
|
||||||
r.Fmt(FMT_STRING("playlist_directory: {}\n"), spl_path.ToUTF8());
|
r.Fmt(FMT_STRING("playlist_directory: {}\n"), spl_path.ToUTF8());
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user