render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From ed7c9cb6444ec9344ebb253eac417703c5371c2d Mon Sep 17 00:00:00 2001
Message-Id: <ed7c9cb6444ec9344ebb253eac417703c5371c2d@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 21 Jun 2019 09:25:31 +0200
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 <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 0fdc0ad84c7ea27480f6f4edb82389d414584ada)

https://bugzilla.redhat.com/show_bug.cgi?id=1697627

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <8ffc18c0ee7c61e5e1ce1af023ee7e6c62726f5a.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 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 9c0f39e76d..0582be63e2 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -403,18 +403,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;
-- 
2.22.0