conf: Use virXMLFormatElement in virDomainControllerDriverFormat

Refactor adding of the controller <driver> element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-03-05 09:51:03 +01:00
parent 5a690f695f
commit 53c11edef9

View File

@ -24255,7 +24255,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
}
static void
static int
virDomainControllerDriverFormat(virBufferPtr buf,
virDomainControllerDefPtr def)
{
@ -24280,11 +24280,7 @@ virDomainControllerDriverFormat(virBufferPtr buf,
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
if (virBufferError(&driverBuf) != 0 || virBufferUse(&driverBuf)) {
virBufferAddLit(buf, "<driver");
virBufferAddBuffer(buf, &driverBuf);
virBufferAddLit(buf, "/>\n");
}
return virXMLFormatElement(buf, "driver", &driverBuf, NULL);
}
@ -24417,7 +24413,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
}
}
virDomainControllerDriverFormat(&childBuf, def);
if (virDomainControllerDriverFormat(&childBuf, def) < 0)
goto cleanup;
if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
goto cleanup;