[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/7] Use qemuDomainMachineIs helpers when adding default devices



Do not duplicate the string comparisons by writing them twice.
---
 src/qemu/qemu_domain.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3f1fbd7..c17abbb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1740,8 +1740,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
             addDefaultUSB = false;
             break;
         }
-        if (STRPREFIX(def->os.machine, "pc-q35") ||
-            STREQ(def->os.machine, "q35")) {
+        if (qemuDomainMachineIsQ35(def)) {
             addPCIeRoot = true;
             addImplicitSATA = true;
 
@@ -1754,11 +1753,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
                 addDefaultUSB = false;
             break;
         }
-        if (!STRPREFIX(def->os.machine, "pc-0.") &&
-            !STRPREFIX(def->os.machine, "pc-1.") &&
-            !STRPREFIX(def->os.machine, "pc-i440") &&
-            STRNEQ(def->os.machine, "pc") &&
-            !STRPREFIX(def->os.machine, "rhel"))
+        if (!qemuDomainMachineIsI440FX(def))
             break;
         addPCIRoot = true;
         break;
-- 
2.7.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]