[libvirt] [PATCH 10/24] conf: numa: Reformat virDomainNumatuneParseXML
Peter Krempa
pkrempa at redhat.com
Mon Feb 16 18:51:58 UTC 2015
Make collapse few of the conditions so that the program flow is more
clear.
---
src/conf/numa_conf.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 391ef15..18c21d5 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -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);
--
2.2.2
More information about the libvir-list
mailing list