From 0fdc0ad84c7ea27480f6f4edb82389d414584ada Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 15 Mar 2019 16:37:28 +0100 Subject: [PATCH] cpu_x86: Simplify x86DataAdd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The while loop just copied half of virCPUx86DataAddItem. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 121c88ad43..41067617df 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -405,18 +405,11 @@ x86DataAdd(virCPUx86Data *data1, const virCPUx86Data *data2) { virCPUx86DataIterator iter = virCPUx86DataIteratorInit(data2); - virCPUx86DataItemPtr item1; - virCPUx86DataItemPtr item2; - - while ((item2 = virCPUx86DataNext(&iter))) { - item1 = virCPUx86DataGet(data1, item2); + virCPUx86DataItemPtr item; - if (item1) { - x86cpuidSetBits(&item1->cpuid, &item2->cpuid); - } else { - if (virCPUx86DataAddItem(data1, item2) < 0) - return -1; - } + while ((item = virCPUx86DataNext(&iter))) { + if (virCPUx86DataAddItem(data1, item) < 0) + return -1; } return 0; -- GitLab