summaryrefslogtreecommitdiff
path: root/src/client/Process.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-04-03 22:30:38 +0200
committerMax Kellermann <max@musicpd.org>2019-04-03 22:30:38 +0200
commit2142d070a35bfca1464d1c7f3b3ab7eba9b9addc (patch)
tree795f7507979498e2cf24d655814e6aafd7e96975 /src/client/Process.cxx
parent9711cee26d52e46a4d2bfccdf9198577f5b9eb0a (diff)
client/Process: refactor `return` statements
Diffstat (limited to 'src/client/Process.cxx')
-rw-r--r--src/client/Process.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/Process.cxx b/src/client/Process.cxx
index 58e8c4548..b62a549b1 100644
--- a/src/client/Process.cxx
+++ b/src/client/Process.cxx
@@ -65,8 +65,6 @@ Client::ProcessLine(char *line) noexcept
return CommandResult::CLOSE;
}
- CommandResult ret;
-
if (StringIsEqual(line, "noidle")) {
if (idle_waiting) {
/* send empty idle response and leave idle mode */
@@ -96,8 +94,8 @@ Client::ProcessLine(char *line) noexcept
auto &&list = cmd_list.Commit();
- ret = ProcessCommandList(cmd_list.IsOKMode(),
- std::move(list));
+ auto ret = ProcessCommandList(cmd_list.IsOKMode(),
+ std::move(list));
FormatDebug(client_domain,
"[%u] process command "
"list returned %i", num, int(ret));
@@ -110,6 +108,8 @@ Client::ProcessLine(char *line) noexcept
command_success(*this);
cmd_list.Reset();
+
+ return ret;
} else {
if (!cmd_list.Add(line)) {
FormatWarning(client_domain,
@@ -120,20 +120,20 @@ Client::ProcessLine(char *line) noexcept
return CommandResult::CLOSE;
}
- ret = CommandResult::OK;
+ return CommandResult::OK;
}
} else {
if (StringIsEqual(line, CLIENT_LIST_MODE_BEGIN)) {
cmd_list.Begin(false);
- ret = CommandResult::OK;
+ return CommandResult::OK;
} else if (StringIsEqual(line, CLIENT_LIST_OK_MODE_BEGIN)) {
cmd_list.Begin(true);
- ret = CommandResult::OK;
+ return CommandResult::OK;
} else {
FormatDebug(client_domain,
"[%u] process command \"%s\"",
num, line);
- ret = command_process(*this, 0, line);
+ auto ret = command_process(*this, 0, line);
FormatDebug(client_domain,
"[%u] command returned %i",
num, int(ret));
@@ -143,8 +143,8 @@ Client::ProcessLine(char *line) noexcept
if (ret == CommandResult::OK)
command_success(*this);
+
+ return ret;
}
}
-
- return ret;
}