]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu: Make comparing PowerPC CPUs easier to read
authorJiri Denemark <jdenemar@redhat.com>
Tue, 18 Dec 2012 22:32:01 +0000 (23:32 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 19 Apr 2013 12:33:15 +0000 (14:33 +0200)
Revert the condition to make it easier to read. The function is also
renamed as ppcCompare to match other functions in PowerPC CPU driver.

src/cpu/cpu_powerpc.c

index 5e1a7b9c9220ef808041fb4ad4c96b5c418dac8e..ea4f9caa1ec6a19fb6242360592bae55c9882d71 100644 (file)
@@ -414,15 +414,14 @@ no_memory:
 }
 
 static virCPUCompareResult
-PowerPCCompare(virCPUDefPtr host,
+ppcCompare(virCPUDefPtr host,
            virCPUDefPtr cpu)
 {
-    if ((cpu->arch != VIR_ARCH_NONE &&
-         (host->arch != cpu->arch)) ||
-        STRNEQ(host->model, cpu->model))
-        return VIR_CPU_COMPARE_INCOMPATIBLE;
+    if ((cpu->arch == VIR_ARCH_NONE || host->arch == cpu->arch) &&
+        STREQ(host->model, cpu->model))
+        return VIR_CPU_COMPARE_IDENTICAL;
 
-    return VIR_CPU_COMPARE_IDENTICAL;
+    return VIR_CPU_COMPARE_INCOMPATIBLE;
 }
 
 static int
@@ -631,7 +630,7 @@ struct cpuArchDriver cpuDriverPowerPC = {
     .name = "ppc64",
     .arch = archs,
     .narch = ARRAY_CARDINALITY(archs),
-    .compare    = PowerPCCompare,
+    .compare    = ppcCompare,
     .decode     = PowerPCDecode,
     .encode     = NULL,
     .free       = PowerPCDataFree,