]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Ignore subsequent attempts to probe device properties
authorAndrea Bolognani <abologna@redhat.com>
Tue, 6 Mar 2018 12:43:26 +0000 (13:43 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 8 Mar 2018 15:05:47 +0000 (16:05 +0100)
In some cases, we are probing multiple devices for the same
property and setting the corresponding capability if it's
found on any of the devices: when that happens, we can quit
early after finding the first property and avoiding a bunch
of string comparisons.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_capabilities.c

index 4dec0046df4f0728a6e71ef0e6f5e2cda055c904..853e8cefcff4444926214ce0b6c94e6e8afba5ce 100644 (file)
@@ -1978,6 +1978,9 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
 {
     size_t i, j;
     for (i = 0; i < nflags; i++) {
+        if (virQEMUCapsGet(qemuCaps, flags[i].flag))
+            continue;
+
         for (j = 0; j < nvalues; j++) {
             if (STREQ(values[j], flags[i].value)) {
                 virQEMUCapsSet(qemuCaps, flags[i].flag);