提交 dcea889b 编写于 作者: P Peter Krempa

tests: qemumonitor: Simplify handling of end of file in full file test

On EOF, the loop can be terminated right away since most of it is
skipped anyways and the handling of the last command is repeated after
the loop.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 21516704
......@@ -1417,9 +1417,12 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
tmp = jsonstr;
command = tmp;
while ((tmp = strchr(tmp, '\n'))) {
bool eof = !tmp[1];
line++;
/* eof */
if (!tmp[1])
break;
if (*(tmp + 1) != '\n') {
*tmp = ' ';
tmp++;
......@@ -1435,7 +1438,6 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
response = NULL;
}
if (!eof) {
/* Move the @tmp and @singleReply. */
tmp += 2;
......@@ -1448,10 +1450,6 @@ qemuMonitorTestNewFromFileFull(const char *fileName,
}
}
if (eof)
break;
}
if (command) {
if (!response) {
virReportError(VIR_ERR_INTERNAL_ERROR, "missing response for command "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册