From: Jiri Denemark Date: Tue, 18 Dec 2012 22:32:01 +0000 (+0100) Subject: cpu: Make comparing PowerPC CPUs easier to read X-Git-Tag: v1.0.5-rc1~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6af5a06275dedd3b438f3e1f20cb4a5b8bea15e1;p=thirdparty%2Flibvirt.git cpu: Make comparing PowerPC CPUs easier to read Revert the condition to make it easier to read. The function is also renamed as ppcCompare to match other functions in PowerPC CPU driver. --- diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 5e1a7b9c92..ea4f9caa1e 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -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,