[PATCH 1/5] virCapabilitiesHostNUMAFormat: Swap order of arguments

Michal Privoznik mprivozn at redhat.com
Wed May 5 08:02:20 UTC 2021


The rest of virCapabilities format functions take virBuffer as
the first argument and struct to format as the second. Also, they
accept NULL (as the second argument). Fix
virCapabilitiesHostNUMAFormat() so that it follows this logic.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/conf/capabilities.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 9bd59b3cbf..084e09286d 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -794,13 +794,16 @@ virCapabilitiesAddStoragePool(virCaps *caps,
 
 
 static int
-virCapabilitiesHostNUMAFormat(virCapsHostNUMA *caps,
-                              virBuffer *buf)
+virCapabilitiesHostNUMAFormat(virBuffer *buf,
+                              virCapsHostNUMA *caps)
 {
     size_t i;
     size_t j;
     char *siblings;
 
+    if (!caps)
+        return 0;
+
     virBufferAddLit(buf, "<topology>\n");
     virBufferAdjustIndent(buf, 2);
     virBufferAsprintf(buf, "<cells num='%d'>\n", caps->cells->len);
@@ -1125,8 +1128,7 @@ virCapabilitiesFormatHostXML(virCapsHost *host,
         virBufferAsprintf(buf, "<netprefix>%s</netprefix>\n",
                           host->netprefix);
 
-    if (host->numa &&
-        virCapabilitiesHostNUMAFormat(host->numa, buf) < 0)
+    if (virCapabilitiesHostNUMAFormat(buf, host->numa) < 0)
         return -1;
 
     if (virCapabilitiesFormatCaches(buf, &host->cache) < 0)
-- 
2.26.3




More information about the libvir-list mailing list