[PATCH 3/6] Use 'virBitmapNewCopy' instead of 'virBitmapCopy'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are only 3 places using the function. Two can use virBitmapNewCopy
directly. In case of the qemu capabilities code we need to free the old
bitmap first.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/capabilities.c      | 3 +--
 src/qemu/qemu_capabilities.c | 3 ++-
 src/util/virresctrl.c        | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index da2633761d..0ba7323ee8 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1589,8 +1589,7 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMAPtr caps)
                         cpus[cid].die_id = 0;
                         cpus[cid].socket_id = s;
                         cpus[cid].core_id = c;
-                        cpus[cid].siblings = virBitmapNew(ncpus);
-                        virBitmapCopy(cpus[cid].siblings, siblings);
+                        cpus[cid].siblings = virBitmapNewCopy(siblings);
                         cid++;
                     }

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e3a934363b..29cb78a388 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1932,7 +1932,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)

     ret->ctime = qemuCaps->ctime;

-    virBitmapCopy(ret->flags, qemuCaps->flags);
+    virBitmapFree(ret->flags);
+    ret->flags = virBitmapNewCopy(qemuCaps->flags);

     ret->version = qemuCaps->version;
     ret->kvmVersion = qemuCaps->kvmVersion;
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index dabfa9990e..aea3fe8687 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -1158,9 +1158,9 @@ virResctrlAllocUpdateMask(virResctrlAllocPtr alloc,
         return -1;

     if (!a_type->masks[cache])
-        a_type->masks[cache] = virBitmapNew(virBitmapSize(mask));
+        a_type->masks[cache] = virBitmapNewCopy(mask);

-    return virBitmapCopy(a_type->masks[cache], mask);
+    return 0;
 }


-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux