[libvirt PATCH v2 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 | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 83fc12c41b..6c4595fd20 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18713,14 +18713,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;
@@ -18729,19 +18727,8 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
             VIR_FREE(loader->path);
     }
 
-    if (readonly_str &&
-        (loader->readonly = virTristateBoolTypeFromString(readonly_str)) <= 0) {
-        virReportError(VIR_ERR_XML_DETAIL,
-                       _("unknown readonly value: %s"), readonly_str);
+    if (virXMLPropTristateBool(node, "secure", false, &loader->secure) < 0)
         return -1;
-    }
-
-    if (secure_str &&
-        (loader->secure = virTristateBoolTypeFromString(secure_str)) <= 0) {
-        virReportError(VIR_ERR_XML_DETAIL,
-                       _("unknown secure value: %s"), secure_str);
-        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