[libvirt PATCH v3 30/51] domain_conf: Use virXMLPropTristateXXX in virDomainGraphicsDefParseXMLSDL

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 35320fe1e5..4684496522 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13139,10 +13139,8 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
                                 xmlXPathContextPtr ctxt)
 {
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
-    int enableVal;
     xmlNodePtr glNode;
     g_autofree char *fullscreen = virXMLPropString(node, "fullscreen");
-    g_autofree char *enable = NULL;
 
     ctxt->node = node;
 
@@ -13161,20 +13159,14 @@ virDomainGraphicsDefParseXMLSDL(virDomainGraphicsDefPtr def,
 
     glNode = virXPathNode("./gl", ctxt);
     if (glNode) {
-        enable = virXMLPropString(glNode, "enable");
-        if (!enable) {
-            virReportError(VIR_ERR_XML_ERROR, "%s",
-                           _("sdl gl element missing enable"));
+        if (virXMLPropTristateBool(glNode, "enable", false, &def->data.sdl.gl) < 0)
             return -1;
-        }
 
-        enableVal = virTristateBoolTypeFromString(enable);
-        if (enableVal < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unknown enable value '%s'"), enable);
+        if (def->data.sdl.gl == VIR_TRISTATE_BOOL_ABSENT) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("sdl gl element missing enable"));
             return -1;
         }
-        def->data.sdl.gl = enableVal;
     }
 
     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