[libvirt PATCH v3 43/51] domain_conf: Use virXMLPropTristateXXX in virDomainLoaderDefParseXML

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

 



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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dfa8b98aae..55405d129b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18712,14 +18712,12 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
                            virDomainLoaderDefPtr loader,
                            bool fwAutoSelect)
 {
-    g_autofree char *readonly_str = NULL;
-    g_autofree char *secure_str = NULL;
     g_autofree char *type_str = NULL;
 
-    secure_str = virXMLPropString(node, "secure");
-
     if (!fwAutoSelect) {
-        readonly_str = virXMLPropString(node, "readonly");
+        if (virXMLPropTristateBool(node, "readonly", false, &loader->readonly) < 0)
+            return -1;
+
         type_str = virXMLPropString(node, "type");
         if (!(loader->path = virXMLNodeContentString(node)))
             return -1;
@@ -18728,25 +18726,8 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
             VIR_FREE(loader->path);
     }
 
-    if (readonly_str) {
-        int value;
-        if ((value = virTristateBoolTypeFromString(readonly_str)) <= 0) {
-            virReportError(VIR_ERR_XML_DETAIL,
-                           _("unknown readonly value: %s"), readonly_str);
-            return -1;
-        }
-        loader->readonly = value;
-    }
-
-    if (secure_str) {
-        int value;
-        if ((value = virTristateBoolTypeFromString(secure_str)) <= 0) {
-            virReportError(VIR_ERR_XML_DETAIL,
-                           _("unknown secure value: %s"), secure_str);
-            return -1;
-        }
-        loader->secure = value;
-    }
+    if (virXMLPropTristateBool(node, "secure", false, &loader->secure) < 0)
+        return -1;
 
     if (type_str) {
         int type;
-- 
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