[libvirt PATCH 16/16] virDomainFeaturesDefParse: Simplify APIC parsing

Tim Wiederhake posted 16 patches 3 years, 4 months ago
[libvirt PATCH 16/16] virDomainFeaturesDefParse: Simplify APIC parsing
Posted by Tim Wiederhake 3 years, 4 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/conf/domain_conf.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 50717c4f44..d78f846a52 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17532,7 +17532,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
         return -1;
 
     for (i = 0; i < n; i++) {
-        g_autofree char *tmp = NULL;
         int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
         if (val < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -17541,18 +17540,6 @@ virDomainFeaturesDefParse(virDomainDef *def,
         }
 
         switch ((virDomainFeature) val) {
-        case VIR_DOMAIN_FEATURE_APIC:
-            if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
-                int eoi;
-                if ((eoi = virTristateSwitchTypeFromString(tmp)) <= 0) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   _("unknown value for attribute eoi: '%s'"),
-                                   tmp);
-                    return -1;
-                }
-                def->apic_eoi = eoi;
-            }
-            G_GNUC_FALLTHROUGH;
         case VIR_DOMAIN_FEATURE_ACPI:
         case VIR_DOMAIN_FEATURE_PAE:
         case VIR_DOMAIN_FEATURE_VIRIDIAN:
@@ -17560,6 +17547,16 @@ virDomainFeaturesDefParse(virDomainDef *def,
             def->features[val] = VIR_TRISTATE_SWITCH_ON;
             break;
 
+        case VIR_DOMAIN_FEATURE_APIC: {
+            virTristateSwitch eoi;
+            if (virXMLPropTristateSwitch(nodes[i], "eoi", VIR_XML_PROP_NONE, &eoi) < 0)
+                return -1;
+
+            def->features[val] = VIR_TRISTATE_SWITCH_ON;
+            def->apic_eoi = eoi;
+            break;
+        }
+
         case VIR_DOMAIN_FEATURE_MSRS: {
             virDomainMsrsUnknown unknown;
             if (virXMLPropEnum(nodes[i], "unknown",
-- 
2.31.1