Extract it to virDomainCapsFormatFeatures so that the main function does
not get so bloated over time.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_capabilities.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 099963dc6a..2c1c5fc9e8 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -600,6 +600,23 @@ virDomainCapsFeatureSEVFormat(virBufferPtr buf,
}
+static void
+virDomainCapsFormatFeatures(const virDomainCaps *caps,
+ virBufferPtr buf)
+{
+ virBufferAddLit(buf, "<features>\n");
+ virBufferAdjustIndent(buf, 2);
+
+ virDomainCapsFeatureGICFormat(buf, &caps->gic);
+ qemuDomainCapsFeatureFormatSimple(buf, "vmcoreinfo", caps->vmcoreinfo);
+ qemuDomainCapsFeatureFormatSimple(buf, "genid", caps->genid);
+ virDomainCapsFeatureSEVFormat(buf, caps->sev);
+
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</features>\n");
+}
+
+
char *
virDomainCapsFormat(const virDomainCaps *caps)
{
@@ -636,16 +653,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</devices>\n");
- virBufferAddLit(&buf, "<features>\n");
- virBufferAdjustIndent(&buf, 2);
-
- virDomainCapsFeatureGICFormat(&buf, &caps->gic);
- qemuDomainCapsFeatureFormatSimple(&buf, "vmcoreinfo",
caps->vmcoreinfo);
- qemuDomainCapsFeatureFormatSimple(&buf, "genid", caps->genid);
- virDomainCapsFeatureSEVFormat(&buf, caps->sev);
-
- virBufferAdjustIndent(&buf, -2);
- virBufferAddLit(&buf, "</features>\n");
+ virDomainCapsFormatFeatures(caps, &buf);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</domainCapabilities>\n");
--
2.23.0