diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 789eb721969264e652a96e578e424515d43bff5f..4bfe629909e6370ed5cafbfa9d612c2095f39254 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -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,21 +1438,16 @@ qemuMonitorTestNewFromFileFull(const char *fileName, response = NULL; } - if (!eof) { - /* Move the @tmp and @singleReply. */ - tmp += 2; + /* Move the @tmp and @singleReply. */ + tmp += 2; - if (!command) { - commandln = line; - command = tmp; - } else { - response = tmp; - } + if (!command) { + commandln = line; + command = tmp; + } else { + response = tmp; } } - - if (eof) - break; } if (command) {