[PATCH] qemu_capabilities: replace code with function call

Kristina Hanicova khanicov at redhat.com
Tue Aug 2 15:50:13 UTC 2022


Since functions virQEMUCapsFillDomainFeatureSEVCaps() and
virQEMUCapsSEVInfoCopy() essentially do the same thing it does
not make sense to have the code duplicated. This patch replaces
the relevant code in the first function with the function call to
the second one.

Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
---

Notes:
    Pointed out by Michal

 src/qemu/qemu_capabilities.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b002fb98ed..53223417ae 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6495,18 +6495,7 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCaps *qemuCaps,
     if (!cap)
         return;
 
-    domCaps->sev = g_new0(virSEVCapability, 1);
-
-    domCaps->sev->pdh = g_strdup(cap->pdh);
-    domCaps->sev->cert_chain = g_strdup(cap->cert_chain);
-    if (cap->cpu0_id != NULL) {
-        domCaps->sev->cpu0_id = g_strdup(cap->cpu0_id);
-    }
-
-    domCaps->sev->cbitpos = cap->cbitpos;
-    domCaps->sev->reduced_phys_bits = cap->reduced_phys_bits;
-    domCaps->sev->max_guests = cap->max_guests;
-    domCaps->sev->max_es_guests = cap->max_es_guests;
+    virQEMUCapsSEVInfoCopy(&domCaps->sev, cap);
 }
 
 
-- 
2.37.1



More information about the libvir-list mailing list