[libvirt PATCH v3 10/51] conf: Use virTristateXXX in virDomainLoaderDef

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 26 ++++++++++++++++----------
 src/conf/domain_conf.h |  4 ++--
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0480fc610d..9e106b8846 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19198,18 +19198,24 @@ 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);
-        return -1;
+    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 &&
-        (loader->secure = virTristateBoolTypeFromString(secure_str)) <= 0) {
-        virReportError(VIR_ERR_XML_DETAIL,
-                       _("unknown secure value: %s"), secure_str);
-        return -1;
+    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 (type_str) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2d342effb1..d6ca5e9725 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2152,9 +2152,9 @@ VIR_ENUM_DECL(virDomainLoader);
 
 struct _virDomainLoaderDef {
     char *path;
-    int readonly;   /* enum virTristateBool */
+    virTristateBool readonly;
     virDomainLoader type;
-    int secure;     /* enum virTristateBool */
+    virTristateBool secure;
     char *nvram;    /* path to non-volatile RAM */
     char *templt;   /* user override of path to master nvram */
 };
-- 
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