From 132ba55a00ef09912badd9de4fcd140dccbcd81c Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 4 Nov 2025 12:25:20 +0100 Subject: [PATCH] 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 Reviewed-by: Peter Krempa --- src/conf/domain_capabilities.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 422b68c085..5a94edf9bc 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -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, "\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, "\n"); } else { virBufferAddLit(buf, "supported='no'/>\n"); -- 2.47.3