Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6997b7d743..920078a706 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6620,8 +6620,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr boot = NULL;
xmlNodePtr rom = NULL;
int ret = -1;
- g_autofree char *romenabled = NULL;
- g_autofree char *rombar = NULL;
g_autofree char *aliasStr = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt)
@@ -6649,24 +6647,12 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
(rom = virXPathNode("./rom", ctxt))) {
- if ((romenabled = virXPathString("string(./rom/@enabled)", ctxt))) {
- int value;
- if ((value = virTristateBoolTypeFromString(romenabled)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown rom enabled value '%s'"),
romenabled);
- goto cleanup;
- }
- info->romenabled = value;
- }
- if ((rombar = virXPathString("string(./rom/@bar)", ctxt))) {
- int value;
- if ((value = virTristateSwitchTypeFromString(rombar)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown rom bar value '%s'"),
rombar);
- goto cleanup;
- }
- info->rombar = value;
- }
+ if (virXMLPropTristateBool(rom, "enabled", false,
&info->romenabled) < 0)
+ goto cleanup;
+
+ if (virXMLPropTristateSwitch(rom, "bar", false, &info->rombar)
< 0)
+ goto cleanup;
+
info->romfile = virXMLPropString(rom, "file");
if (info->romenabled == VIR_TRISTATE_BOOL_NO &&
--
2.26.2