[libvirt PATCH 02/10] virDomainGraphicsDefParseXMLDesktop: Use virXMLProp*

Tim Wiederhake posted 10 patches 1 month, 3 weeks ago

[libvirt PATCH 02/10] virDomainGraphicsDefParseXMLDesktop: Use virXMLProp*

Posted by Tim Wiederhake 1 month, 3 weeks ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5b0e90f234..d57450b3c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12885,18 +12885,13 @@ static int
 virDomainGraphicsDefParseXMLDesktop(virDomainGraphicsDef *def,
                                     xmlNodePtr node)
 {
-    g_autofree char *fullscreen = virXMLPropString(node, "fullscreen");
+    virTristateBool fullscreen = VIR_TRISTATE_BOOL_NO;
 
-    if (fullscreen != NULL) {
-        if (virStringParseYesNo(fullscreen, &def->data.desktop.fullscreen) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unknown fullscreen value '%s'"), fullscreen);
-            return -1;
-        }
-    } else {
-        def->data.desktop.fullscreen = false;
-    }
+    if (virXMLPropTristateBool(node, "fullscreen", VIR_XML_PROP_NONE,
+                               &fullscreen) < 0)
+        return -1;
 
+    def->data.desktop.fullscreen = fullscreen == VIR_TRISTATE_BOOL_YES;
     def->data.desktop.display = virXMLPropString(node, "display");
 
     return 0;
-- 
2.26.3