[libvirt PATCH v2 38/51] domain_conf: Use virXMLPropTristateXXX in virDomainPerfEventDefParseXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux