On 9/4/21 4:44 PM, Ján Tomko wrote:
6 files changed, 51 insertions(+), 105 deletions(-)
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 10d02bd1b4..bef6dfd152 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -471,51 +471,39 @@ qemuAgentShutdownTestMonitorHandler(qemuMonitorTest *test,
virJSONValue *args;
const char *cmdname;
const char *mode;
- int ret = -1;
data = qemuMonitorTestItemGetPrivateData(item);
if (!(val = virJSONValueFromString(cmdstr)))
return -1;
- if (!(cmdname = virJSONValueObjectGetString(val, "execute"))) {
- ret = qemuMonitorTestAddErrorResponse(test, "Missing command name in
%s", cmdstr);
- goto cleanup;
- }
+ if (!(cmdname = virJSONValueObjectGetString(val, "execute")))
+ return qemuMonitorTestAddErrorResponse(test, "Missing command name in
%s", cmdstr);
if (STRNEQ(cmdname, "guest-shutdown")) {
- ret = qemuMonitorTestAddInvalidCommandResponse(test,
"guest-shutdown",
+ return qemuMonitorTestAddInvalidCommandResponse(test,
"guest-shutdown",
cmdname);
I would have moved that up to the previous line so I could get rid of
the braces - you lost out on 2 points in the "reducing line count"
battle :-P
- goto cleanup;
}
if (!(args = virJSONValueObjectGet(val, "arguments"))) {
- ret = qemuMonitorTestAddErrorResponse(test,
+ return qemuMonitorTestAddErrorResponse(test,
"Missing arguments section");
Same here.