[PATCH 9/9] virCPUDefFormatBufFull: Use virXMLFormatElement

Peter Krempa pkrempa at redhat.com
Fri Oct 30 16:47:47 UTC 2020


The function was basically open-coding it.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/cpu_conf.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 7778e01131..5cf7716b12 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -743,21 +743,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
     if (virDomainNumaDefFormatXML(&childrenBuf, numa) < 0)
         return -1;

-    /* Put it all together */
-    if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) {
-        virBufferAddLit(buf, "<cpu");
-
-        if (virBufferUse(&attributeBuf))
-            virBufferAddBuffer(buf, &attributeBuf);
-
-        if (virBufferUse(&childrenBuf)) {
-            virBufferAddLit(buf, ">\n");
-            virBufferAddBuffer(buf, &childrenBuf);
-            virBufferAddLit(buf, "</cpu>\n");
-        } else {
-            virBufferAddLit(buf, "/>\n");
-        }
-    }
+    virXMLFormatElement(buf, "cpu", &attributeBuf, &childrenBuf);

     return 0;
 }
-- 
2.26.2




More information about the libvir-list mailing list