Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8ca6cd2e44..ef1f930a96 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15443,7 +15443,7 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf,
{
int event;
g_autofree char *name = NULL;
- g_autofree char *enabled = NULL;
+ virTristateBool enabled = VIR_TRISTATE_BOOL_ABSENT;
if (!(name = virXMLPropString(node, "name"))) {
virReportError(VIR_ERR_XML_ERROR, "%s", _("missing perf event
name"));
@@ -15462,18 +15462,9 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf,
return -1;
}
- if (!(enabled = virXMLPropString(node, "enabled"))) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing state of perf event '%s'"), name);
- return -1;
- }
-
- if ((perf->events[event] = virTristateBoolTypeFromString(enabled)) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("invalid state '%s' of perf event
'%s'"),
- enabled, name);
+ if (virXMLPropTristateBool(node, "enabled", true, &enabled) < 0)
return -1;
- }
+ perf->events[event] = enabled;
return 0;
}
--
2.26.2