Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 47 ++++++++++-------------------------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1878d9ed9d..4c88a124bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18837,15 +18837,16 @@ virDomainLoaderDefParseXML(xmlNodePtr node, virDomainLoaderDef *loader, bool fwAutoSelect) { - g_autofree char *readonly_str = NULL; - g_autofree char *secure_str = NULL; - g_autofree char *type_str = NULL; + if (!fwAutoSelect) { + if (virXMLPropTristateBool(node, "readonly", VIR_XML_PROP_NONE, + &loader->readonly) < 0) + return -1; - secure_str = virXMLPropString(node, "secure"); + if (virXMLPropEnum(node, "type", virDomainLoaderTypeFromString, + VIR_XML_PROP_NONE | VIR_XML_PROP_NONZERO, + &loader->type) < 0) + return -1; - if (!fwAutoSelect) { - readonly_str = virXMLPropString(node, "readonly"); - type_str = virXMLPropString(node, "type"); if (!(loader->path = virXMLNodeContentString(node))) return -1; @@ -18853,35 +18854,9 @@ virDomainLoaderDefParseXML(xmlNodePtr node, VIR_FREE(loader->path); } - if (readonly_str) { - int value; - if ((value = virTristateBoolTypeFromString(readonly_str)) <= 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown readonly value: %s"), readonly_str); - return -1; - } - loader->readonly = value; - } - - if (secure_str) { - int value; - if ((value = virTristateBoolTypeFromString(secure_str)) <= 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown secure value: %s"), secure_str); - return -1; - } - loader->secure = value; - } - - if (type_str) { - int type; - if ((type = virDomainLoaderTypeFromString(type_str)) <= 0) { - virReportError(VIR_ERR_XML_DETAIL, - _("unknown type value: %s"), type_str); - return -1; - } - loader->type = type; - } + if (virXMLPropTristateBool(node, "secure", VIR_XML_PROP_NONE, + &loader->secure) < 0) + return -1; return 0; } -- 2.26.3