]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: numa: Reformat virDomainNumatuneParseXML
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Feb 2015 14:34:05 +0000 (15:34 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 20 Feb 2015 16:43:04 +0000 (17:43 +0100)
Collapse few of the conditions so that the program flow is more clear.

src/conf/numa_conf.c

index 39061adc86690260dd156479bcc6def861b64ed8..c78e50c9db17b0025da3224f86bf28492c530053 100644 (file)
@@ -245,32 +245,24 @@ virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr,
         goto cleanup;
     }
 
-    tmp = virXMLPropString(node, "mode");
-    if (tmp) {
-        mode = virDomainNumatuneMemModeTypeFromString(tmp);
-        if (mode < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Unsupported NUMA memory tuning mode '%s'"),
-                           tmp);
-            goto cleanup;
-        }
+    if ((tmp = virXMLPropString(node, "mode")) &&
+        (mode = virDomainNumatuneMemModeTypeFromString(tmp)) < 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Unsupported NUMA memory tuning mode '%s'"), tmp);
+        goto cleanup;
     }
     VIR_FREE(tmp);
 
-    tmp = virXMLPropString(node, "placement");
-    if (tmp) {
-        placement = virDomainNumatunePlacementTypeFromString(tmp);
-        if (placement < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Unsupported NUMA memory placement mode '%s'"),
-                           tmp);
-            goto cleanup;
-        }
+    if ((tmp = virXMLPropString(node, "placement")) &&
+        (placement = virDomainNumatunePlacementTypeFromString(tmp)) < 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Unsupported NUMA memory placement mode '%s'"), tmp);
+        goto cleanup;
     }
     VIR_FREE(tmp);
 
-    tmp = virXMLPropString(node, "nodeset");
-    if (tmp && virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
+    if ((tmp = virXMLPropString(node, "nodeset")) &&
+        virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
         goto cleanup;
     VIR_FREE(tmp);