conf: use virXMLFormatElement for <iommu>

Simplify the formatting function even further.
This commit is contained in:
Ján Tomko 2017-08-29 18:37:39 +02:00
parent e844b6e12c
commit 73c336eb46

View File

@ -25073,6 +25073,7 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
const virDomainIOMMUDef *iommu)
{
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer driverAttrBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
@ -25098,16 +25099,11 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
if (virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL) < 0)
goto cleanup;
virBufferAsprintf(buf, "<iommu model='%s'",
virBufferAsprintf(&attrBuf, " model='%s'",
virDomainIOMMUModelTypeToString(iommu->model));
if (virBufferError(&childBuf) != 0 || virBufferUse(&childBuf)) {
virBufferAddLit(buf, ">\n");
virBufferAddBuffer(buf, &childBuf);
virBufferAddLit(buf, "</iommu>\n");
} else {
virBufferAddLit(buf, "/>\n");
}
if (virXMLFormatElement(buf, "iommu", &attrBuf, &childBuf) < 0)
goto cleanup;
ret = 0;