[libvirt PATCH 11/16] virDomainFeaturesXENDefParse: Remove tautological "if"

Tim Wiederhake posted 16 patches 3 years, 4 months ago
[libvirt PATCH 11/16] virDomainFeaturesXENDefParse: Remove tautological "if"
Posted by Tim Wiederhake 3 years, 4 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 58 ++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 45c4b9cedf..02c06d5ab9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17436,47 +17436,45 @@ virDomainFeaturesXENDefParse(virDomainDef *def,
 {
     def->features[VIR_DOMAIN_FEATURE_XEN] = VIR_TRISTATE_SWITCH_ON;
 
-    if (def->features[VIR_DOMAIN_FEATURE_XEN] == VIR_TRISTATE_SWITCH_ON) {
+    node = xmlFirstElementChild(node);
+    while (node) {
         int feature;
         virTristateSwitch value;
 
-        node = xmlFirstElementChild(node);
-        while (node) {
-            feature = virDomainXenTypeFromString((const char *)node->name);
-            if (feature < 0) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("unsupported Xen feature: %s"),
-                               node->name);
-                return -1;
-            }
-
-            if (virXMLPropTristateSwitch(node, "state",
-                                         VIR_XML_PROP_REQUIRED, &value) < 0)
-                return -1;
+        feature = virDomainXenTypeFromString((const char *)node->name);
+        if (feature < 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("unsupported Xen feature: %s"),
+                           node->name);
+            return -1;
+        }
 
-            def->xen_features[feature] = value;
+        if (virXMLPropTristateSwitch(node, "state",
+                                     VIR_XML_PROP_REQUIRED, &value) < 0)
+            return -1;
 
-            switch ((virDomainXen) feature) {
-                case VIR_DOMAIN_XEN_E820_HOST:
-                    break;
+        def->xen_features[feature] = value;
 
-            case VIR_DOMAIN_XEN_PASSTHROUGH:
-                if (value != VIR_TRISTATE_SWITCH_ON)
-                    break;
+        switch ((virDomainXen) feature) {
+        case VIR_DOMAIN_XEN_E820_HOST:
+            break;
 
-                if (virXMLPropEnum(node, "mode",
-                                   virDomainXenPassthroughModeTypeFromString,
-                                   VIR_XML_PROP_NONZERO,
-                                   &def->xen_passthrough_mode) < 0)
-                    return -1;
+        case VIR_DOMAIN_XEN_PASSTHROUGH:
+            if (value != VIR_TRISTATE_SWITCH_ON)
                 break;
 
-                case VIR_DOMAIN_XEN_LAST:
-                    break;
-            }
+            if (virXMLPropEnum(node, "mode",
+                               virDomainXenPassthroughModeTypeFromString,
+                               VIR_XML_PROP_NONZERO,
+                               &def->xen_passthrough_mode) < 0)
+                return -1;
+            break;
 
-            node = xmlNextElementSibling(node);
+            case VIR_DOMAIN_XEN_LAST:
+                break;
         }
+
+        node = xmlNextElementSibling(node);
     }
 
     return 0;
-- 
2.31.1