Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b6e505b384..3a4b01ad1e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1590,9 +1590,7 @@ static int virDomainVirtioOptionsParseXML(xmlNodePtr driver, virDomainVirtioOptionsPtr *virtio) { - int val; virDomainVirtioOptionsPtr res; - g_autofree char *str = NULL; if (*virtio || !driver) return 0; @@ -1601,34 +1599,14 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver, res = *virtio; - if ((str = virXMLPropString(driver, "iommu"))) { - if ((val = virTristateSwitchTypeFromString(str)) <= 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid iommu value")); - return -1; - } - res->iommu = val; - } - VIR_FREE(str); + if (virXMLPropOnOff(driver, "iommu", &res->iommu) < 0) + return -1; - if ((str = virXMLPropString(driver, "ats"))) { - if ((val = virTristateSwitchTypeFromString(str)) <= 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid ats value")); - return -1; - } - res->ats = val; - } - VIR_FREE(str); + if (virXMLPropOnOff(driver, "ats", &res->ats) < 0) + return -1; - if ((str = virXMLPropString(driver, "packed"))) { - if ((val = virTristateSwitchTypeFromString(str)) <= 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid packed value")); - return -1; - } - res->packed = val; - } + if (virXMLPropOnOff(driver, "packed", &res->packed) < 0) + return -1; return 0; } -- 2.26.2