a41c76
From 33cac9bcf27a885febf12e094cb2579f16a421b6 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <33cac9bcf27a885febf12e094cb2579f16a421b6@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:27 +0200
a41c76
Subject: [PATCH] cpu_x86: Move and rename x86ModelCopySignatures
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Later in this series the function will work on a newly introduced
a41c76
virCPUx86Signatures structure. Let's move it to the place were all
a41c76
related functions will be added and rename the function as
a41c76
virCPUx86SignaturesCopy for easier review of the virCPUx86Signatures
a41c76
patch.
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit a8ec1d746ed41ac76df2e28cbc5683b3e37b9a60)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <0d4f902805cd5534eadedd2ec61385e9798c8b40.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 36 ++++++++++++++++++------------------
a41c76
 1 file changed, 18 insertions(+), 18 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index b4b1b475d6..16e6aa73d2 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1090,23 +1090,9 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
a41c76
 }
a41c76
 
a41c76
 
a41c76
-static void
a41c76
-x86ModelFree(virCPUx86ModelPtr model)
a41c76
-{
a41c76
-    if (!model)
a41c76
-        return;
a41c76
-
a41c76
-    g_free(model->name);
a41c76
-    g_free(model->signatures);
a41c76
-    virCPUx86DataClear(&model->data);
a41c76
-    g_free(model);
a41c76
-}
a41c76
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree);
a41c76
-
a41c76
-
a41c76
 static int
a41c76
-x86ModelCopySignatures(virCPUx86ModelPtr dst,
a41c76
-                       virCPUx86ModelPtr src)
a41c76
+virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
a41c76
+                        virCPUx86ModelPtr src)
a41c76
 {
a41c76
     size_t i;
a41c76
 
a41c76
@@ -1124,6 +1110,20 @@ x86ModelCopySignatures(virCPUx86ModelPtr dst,
a41c76
 }
a41c76
 
a41c76
 
a41c76
+static void
a41c76
+x86ModelFree(virCPUx86ModelPtr model)
a41c76
+{
a41c76
+    if (!model)
a41c76
+        return;
a41c76
+
a41c76
+    g_free(model->name);
a41c76
+    g_free(model->signatures);
a41c76
+    virCPUx86DataClear(&model->data);
a41c76
+    g_free(model);
a41c76
+}
a41c76
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree);
a41c76
+
a41c76
+
a41c76
 static virCPUx86ModelPtr
a41c76
 x86ModelCopy(virCPUx86ModelPtr model)
a41c76
 {
a41c76
@@ -1132,7 +1132,7 @@ x86ModelCopy(virCPUx86ModelPtr model)
a41c76
     copy = g_new0(virCPUx86Model, 1);
a41c76
     copy->name = g_strdup(model->name);
a41c76
 
a41c76
-    if (x86ModelCopySignatures(copy, model) < 0) {
a41c76
+    if (virCPUx86SignaturesCopy(copy, model) < 0) {
a41c76
         x86ModelFree(copy);
a41c76
         return NULL;
a41c76
     }
a41c76
@@ -1360,7 +1360,7 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
a41c76
     }
a41c76
 
a41c76
     model->vendor = ancestor->vendor;
a41c76
-    if (x86ModelCopySignatures(model, ancestor) < 0)
a41c76
+    if (virCPUx86SignaturesCopy(model, ancestor) < 0)
a41c76
         return -1;
a41c76
 
a41c76
     x86DataCopy(&model->data, &ancestor->data);
a41c76
-- 
a41c76
2.26.2
a41c76