[PATCH 2/2] qemuBuildNumaArgStr: Simplify @nodeBackends

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

 



Instead of array of pointers to individual buffers it can be
array of buffers directly.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fb5bb26ad1..1324c672ba 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7478,7 +7478,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
     virQEMUCapsPtr qemuCaps = priv->qemuCaps;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char *cpumask = NULL, *tmpmask = NULL, *next = NULL;
-    virBufferPtr *nodeBackends = NULL;
+    virBufferPtr nodeBackends = NULL;
     bool needBackend = false;
     int rc;
     int ret = -1;
@@ -7540,11 +7540,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
             virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
 
-            if (VIR_ALLOC(nodeBackends[i]) < 0)
-                goto cleanup;
-
             if ((rc = qemuBuildMemoryCellBackendStr(def, cfg, i, priv,
-                                                    nodeBackends[i])) < 0)
+                                                    &nodeBackends[i])) < 0)
                 goto cleanup;
 
             if (rc == 0)
@@ -7578,7 +7575,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
 
         if (needBackend) {
             virCommandAddArg(cmd, "-object");
-            virCommandAddArgBuffer(cmd, nodeBackends[i]);
+            virCommandAddArgBuffer(cmd, &nodeBackends[i]);
         }
 
         virCommandAddArg(cmd, "-numa");
@@ -7641,10 +7638,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
     VIR_FREE(cpumask);
 
     if (nodeBackends) {
-        for (i = 0; i < ncells; i++) {
-            virBufferFreeAndReset(nodeBackends[i]);
-            VIR_FREE(nodeBackends[i]);
-        }
+        for (i = 0; i < ncells; i++)
+            virBufferFreeAndReset(&nodeBackends[i]);
 
         VIR_FREE(nodeBackends);
     }
-- 
2.16.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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