]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Introduce virCPUDefStealModel
authorJiri Denemark <jdenemar@redhat.com>
Thu, 23 Jun 2016 10:54:19 +0000 (12:54 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 22 Sep 2016 13:40:08 +0000 (15:40 +0200)
The function moves CPU model related parts from one CPU definition to
another. It can be used to avoid unnecessary copies from a temporary CPU
definitions which will be freed anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/conf/cpu_conf.c
src/conf/cpu_conf.h
src/libvirt_private.syms

index c6e847aa167626a49e6d0f5a290057c20c05c574..2e78b76d0af8651c47776273612ef749bd8f8bcc 100644 (file)
@@ -115,6 +115,23 @@ virCPUDefCopyModel(virCPUDefPtr dst,
 }
 
 
+void
+virCPUDefStealModel(virCPUDefPtr dst,
+                    virCPUDefPtr src)
+{
+    virCPUDefFreeModel(dst);
+
+    VIR_STEAL_PTR(dst->model, src->model);
+    VIR_STEAL_PTR(dst->vendor, src->vendor);
+    VIR_STEAL_PTR(dst->vendor_id, src->vendor_id);
+    VIR_STEAL_PTR(dst->features, src->features);
+    dst->nfeatures_max = src->nfeatures_max;
+    src->nfeatures_max = 0;
+    dst->nfeatures = src->nfeatures;
+    src->nfeatures = 0;
+}
+
+
 virCPUDefPtr
 virCPUDefCopyWithoutModel(const virCPUDef *cpu)
 {
index 2bbab9efb0cb624d3bfe96bf3420f2ba259329a9..a5dd208cdbf1f81ba83e226a9d07b7b87740082b 100644 (file)
@@ -123,6 +123,10 @@ virCPUDefCopyModel(virCPUDefPtr dst,
                    const virCPUDef *src,
                    bool resetPolicy);
 
+void
+virCPUDefStealModel(virCPUDefPtr dst,
+                    virCPUDefPtr src);
+
 virCPUDefPtr
 virCPUDefCopy(const virCPUDef *cpu);
 
index 26597bbaf540976dd4f531d74a77fe2bacefb9cf..bdedc18548e9fbe79bfe8ea885911a49de5b5fe6 100644 (file)
@@ -72,6 +72,7 @@ virCPUDefFormatBuf;
 virCPUDefFree;
 virCPUDefFreeModel;
 virCPUDefParseXML;
+virCPUDefStealModel;
 virCPUDefUpdateFeature;
 virCPUModeTypeToString;