cpu_x86: Simplify x86DataAdd

The while loop just copied half of virCPUx86DataAddItem.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2019-03-15 16:37:28 +01:00
parent 3eff71a2d5
commit 0fdc0ad84c

View File

@ -405,18 +405,11 @@ x86DataAdd(virCPUx86Data *data1,
const virCPUx86Data *data2)
{
virCPUx86DataIterator iter = virCPUx86DataIteratorInit(data2);
virCPUx86DataItemPtr item1;
virCPUx86DataItemPtr item2;
virCPUx86DataItemPtr item;
while ((item2 = virCPUx86DataNext(&iter))) {
item1 = virCPUx86DataGet(data1, item2);
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;