]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Nov 2025 11:25:20 +0000 (12:25 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 10 Nov 2025 09:32:39 +0000 (10:32 +0100)
The aim of virDomainCapsCPUCustomFormat() is to format CPU models
into given buffer. But it starts by adjusting indentation. Move
this one level up into the caller so that another buffer can be
used. This also makes the pattern match in the caller
(virDomainCapsCPUFormat()) with the rest of CPU related domcaps
formatting.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_capabilities.c

index 422b68c08548430ae406112413bce7ef51bd1f05..5a94edf9bc932b211323512ecb531a9220f6b44d 100644 (file)
@@ -446,8 +446,6 @@ virDomainCapsCPUCustomFormat(virBuffer *buf,
 {
     size_t i;
 
-    virBufferAdjustIndent(buf, 2);
-
     for (i = 0; i < custom->nmodels; i++) {
         virDomainCapsCPUModel *model = custom->models + i;
 
@@ -480,8 +478,6 @@ virDomainCapsCPUCustomFormat(virBuffer *buf,
             virBufferAddLit(buf, "</blockers>\n");
         }
     }
-
-    virBufferAdjustIndent(buf, -2);
 }
 
 static void
@@ -539,7 +535,9 @@ virDomainCapsCPUFormat(virBuffer *buf,
                       virCPUModeTypeToString(VIR_CPU_MODE_CUSTOM));
     if (cpu->custom && cpu->custom->nmodels) {
         virBufferAddLit(buf, "supported='yes'>\n");
+        virBufferAdjustIndent(buf, 2);
         virDomainCapsCPUCustomFormat(buf, cpu->custom);
+        virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</mode>\n");
     } else {
         virBufferAddLit(buf, "supported='no'/>\n");