1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-12-03 16:25:09 +03:00

domain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat()

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>
This commit is contained in:
Michal Privoznik
2025-11-04 12:25:20 +01:00
parent 238be79bb9
commit 132ba55a00

View 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");