From dd8a2cffd650f387295d1741aa273b81ae38383d Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 31 Jan 2023 16:45:07 +0100 Subject: [PATCH] virDomainNetDefFormat: Modernize formatting The child element of is formatted the old way. Switch to virXMLFormatElement(). Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b991a01af3..1cf2bf84bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23685,6 +23685,7 @@ virDomainNetDefFormat(virBuffer *buf, virDomainHostdevDef *hostdef = NULL; char macstr[VIR_MAC_STRING_BUFLEN]; g_auto(virBuffer) targetAttrBuf = VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) macAttrBuf = VIR_BUFFER_INITIALIZER; const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL; /* publicActual is true if we should report the current state in @@ -23725,13 +23726,13 @@ virDomainNetDefFormat(virBuffer *buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); - virBufferAsprintf(buf, "mac, macstr)); if (def->mac_type) - virBufferAsprintf(buf, " type='%s'", virDomainNetMacTypeTypeToString(def->mac_type)); + virBufferAsprintf(&macAttrBuf, " type='%s'", virDomainNetMacTypeTypeToString(def->mac_type)); if (def->mac_check != VIR_TRISTATE_BOOL_ABSENT) - virBufferAsprintf(buf, " check='%s'", virTristateBoolTypeToString(def->mac_check)); - virBufferAddLit(buf, "/>\n"); + virBufferAsprintf(&macAttrBuf, " check='%s'", virTristateBoolTypeToString(def->mac_check)); + virXMLFormatElement(buf, "mac", &macAttrBuf, NULL); if (publicActual) { /* when there is a virDomainActualNetDef, and we haven't been -- 2.47.2