
@@ -1252,11 +1253,15 @@ static unsigned long long qemudComputeCmdFlags(const char *help, if (strstr(help, "readonly=")) flags |= QEMUD_CMD_FLAG_DRIVE_READONLY; } - if (strstr(help, "-vga") && !strstr(help, "-std-vga")) { + if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
I think this can be simplified to work via a single scan, rather than having to do a second scan to filter out the older -std-vga:
if ((p = strstr(help, "\n-vga") != NULL) {
Hmm, it's not exactly the same thing. In case there were both "-vga" and "-std-vga" present, the new condition would return true while the original would fail. I doubt there is a qemu version out there which would provide both but to be safe I will leave it as is.
flags |= QEMUD_CMD_FLAG_VGA;
if (strstr(help, "|qxl")) flags |= QEMUD_CMD_FLAG_VGA_QXL;
Ouch - we don't have anything in tests/qemuhelpdata/ that tests this line of code. But that's an independent problem.
Meanwhile, that could be made more efficient via strstr(p, "|qxl") (no need to reparse the chunk between help and p).
Yeah, makes sense. I'll change this.
+ if ((p = strstr(p, "|none")) && p < nl) + flags |= QEMUD_CMD_FLAG_VGA_NONE;
qemu -help parsing is so brittle. But this looks correct.
ACK - I can live with the patch as-is (since you want to backport it rapidly to RHEL); or you can take the time to make the tweaks above.
Thanks, I made the small change above and pushed. Jirka