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