[libvirt] [PATCH 04/15] Remove unneeded curly brackets around oneline code blocks in src/hyperv/

Martin Kletzander mkletzan at redhat.com
Thu Nov 6 16:38:29 UTC 2014


As stated in our contributor guidelines, we don't want curly brackets
around oneline code block (with some exceptions).

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/hyperv/hyperv_device_monitor.c   |   3 +-
 src/hyperv/hyperv_driver.c           | 132 ++++++++++++-----------------------
 src/hyperv/hyperv_interface_driver.c |   3 +-
 src/hyperv/hyperv_network_driver.c   |   3 +-
 src/hyperv/hyperv_nwfilter_driver.c  |   3 +-
 src/hyperv/hyperv_secret_driver.c    |   3 +-
 src/hyperv/hyperv_storage_driver.c   |   3 +-
 src/hyperv/hyperv_util.c             |   6 +-
 src/hyperv/hyperv_wmi.c              |  45 ++++--------
 9 files changed, 67 insertions(+), 134 deletions(-)

diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c
index 5332eb2..88f81bf 100644
--- a/src/hyperv/hyperv_device_monitor.c
+++ b/src/hyperv/hyperv_device_monitor.c
@@ -40,9 +40,8 @@ hypervNodeDeviceOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->nodeDevicePrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 5ffcb85..9ff08af 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -49,9 +49,8 @@ VIR_LOG_INIT("hyperv.hyperv_driver");
 static void
 hypervFreePrivate(hypervPrivate **priv)
 {
-    if (priv == NULL || *priv == NULL) {
+    if (priv == NULL || *priv == NULL)
         return;
-    }

     if ((*priv)->client != NULL) {
         /* FIXME: This leaks memory due to bugs in openwsman <= 2.2.6 */
@@ -78,22 +77,19 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

     /* Decline if the URI is NULL or the scheme is NULL */
-    if (conn->uri == NULL || conn->uri->scheme == NULL) {
+    if (conn->uri == NULL || conn->uri->scheme == NULL)
         return VIR_DRV_OPEN_DECLINED;
-    }

     /* Decline if the scheme is not hyperv */
     plus = strchr(conn->uri->scheme, '+');

     if (plus == NULL) {
-        if (STRCASENEQ(conn->uri->scheme, "hyperv")) {
+        if (STRCASENEQ(conn->uri->scheme, "hyperv"))
             return VIR_DRV_OPEN_DECLINED;
-        }
     } else {
         if (plus - conn->uri->scheme != 6 ||
-            STRCASENEQLEN(conn->uri->scheme, "hyperv", 6)) {
+            STRCASENEQLEN(conn->uri->scheme, "hyperv", 6))
             return VIR_DRV_OPEN_DECLINED;
-        }

         virReportError(VIR_ERR_INVALID_ARG,
                        _("Transport '%s' in URI scheme is not supported, try again "
@@ -119,9 +115,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
     if (VIR_ALLOC(priv) < 0)
         goto cleanup;

-    if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
+    if (hypervParseUri(&priv->parsedUri, conn->uri) < 0)
         goto cleanup;
-    }

     /* Set the port dependent on the transport protocol if no port is
      * specified. This allows us to rely on the port parameter being
@@ -182,9 +177,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
     virBufferAddLit(&query, "where ");
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_PHYSICAL);

-    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -239,9 +233,8 @@ hypervConnectGetHostname(virConnectPtr conn)

     virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);

-    if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -276,9 +269,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
     virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);

     /* Get Win32_ComputerSystem */
-    if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -295,9 +287,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
                       "ResultClass = Win32_Processor",
                       computerSystem->data->Name);

-    if (hypervGetWin32ProcessorList(priv, &query, &processorList) < 0) {
+    if (hypervGetWin32ProcessorList(priv, &query, &processorList) < 0)
         goto cleanup;
-    }

     if (processorList == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -339,9 +330,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
     info->sockets = 0;

     for (processor = processorList; processor != NULL;
-         processor = processor->next) {
+         processor = processor->next)
         ++info->sockets;
-    }

     info->cores = processorList->data->NumberOfCores;
     info->threads = info->cores / processorList->data->NumberOfLogicalProcessors;
@@ -368,9 +358,8 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
     Msvm_ComputerSystem *computerSystem = NULL;
     int count = 0;

-    if (maxids == 0) {
+    if (maxids == 0)
         return 0;
-    }

     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
     virBufferAddLit(&query, "where ");
@@ -379,17 +368,15 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_ACTIVE);

     if (hypervGetMsvmComputerSystemList(priv, &query,
-                                        &computerSystemList) < 0) {
+                                        &computerSystemList) < 0)
         goto cleanup;
-    }

     for (computerSystem = computerSystemList; computerSystem != NULL;
          computerSystem = computerSystem->next) {
         ids[count++] = computerSystem->data->ProcessID;

-        if (count >= maxids) {
+        if (count >= maxids)
             break;
-        }
     }

     success = true;
@@ -419,14 +406,12 @@ hypervConnectNumOfDomains(virConnectPtr conn)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_ACTIVE);

     if (hypervGetMsvmComputerSystemList(priv, &query,
-                                        &computerSystemList) < 0) {
+                                        &computerSystemList) < 0)
         goto cleanup;
-    }

     for (computerSystem = computerSystemList; computerSystem != NULL;
-         computerSystem = computerSystem->next) {
+         computerSystem = computerSystem->next)
         ++count;
-    }

     success = true;

@@ -451,9 +436,8 @@ hypervDomainLookupByID(virConnectPtr conn, int id)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
     virBufferAsprintf(&query, "and ProcessID = %d", id);

-    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
@@ -486,9 +470,8 @@ hypervDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
     virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);

-    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -519,9 +502,8 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
     virBufferAsprintf(&query, "and ElementName = \"%s\"", name);

-    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
+    if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN,
@@ -546,9 +528,8 @@ hypervDomainSuspend(virDomainPtr domain)
     hypervPrivate *priv = domain->conn->privateData;
     Msvm_ComputerSystem *computerSystem = NULL;

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem->data->EnabledState !=
         MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
@@ -575,9 +556,8 @@ hypervDomainResume(virDomainPtr domain)
     hypervPrivate *priv = domain->conn->privateData;
     Msvm_ComputerSystem *computerSystem = NULL;

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem->data->EnabledState !=
         MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) {
@@ -607,9 +587,8 @@ hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags)

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
         in_transition) {
@@ -665,9 +644,8 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
     virUUIDFormat(domain->uuid, uuid_string);

     /* Get Msvm_ComputerSystem */
-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     /* Get Msvm_VirtualSystemSettingData */
     virBufferAsprintf(&query,
@@ -679,9 +657,8 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
                       uuid_string);

     if (hypervGetMsvmVirtualSystemSettingDataList(priv, &query,
-                                                  &virtualSystemSettingData) < 0) {
+                                                  &virtualSystemSettingData) < 0)
         goto cleanup;
-    }

     if (virtualSystemSettingData == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -700,9 +677,8 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
                       virtualSystemSettingData->data->InstanceID);

     if (hypervGetMsvmProcessorSettingDataList(priv, &query,
-                                              &processorSettingData) < 0) {
+                                              &processorSettingData) < 0)
         goto cleanup;
-    }

     if (processorSettingData == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -721,9 +697,8 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
                       virtualSystemSettingData->data->InstanceID);

     if (hypervGetMsvmMemorySettingDataList(priv, &query,
-                                           &memorySettingData) < 0) {
+                                           &memorySettingData) < 0)
         goto cleanup;
-    }


     if (memorySettingData == NULL) {
@@ -764,15 +739,13 @@ hypervDomainGetState(virDomainPtr domain, int *state, int *reason,

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     *state = hypervMsvmComputerSystemEnabledStateToDomainState(computerSystem);

-    if (reason != NULL) {
+    if (reason != NULL)
         *reason = 0;
-    }

     result = 0;

@@ -805,9 +778,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     virUUIDFormat(domain->uuid, uuid_string);

     /* Get Msvm_ComputerSystem */
-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     /* Get Msvm_VirtualSystemSettingData */
     virBufferAsprintf(&query,
@@ -819,9 +791,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
                       uuid_string);

     if (hypervGetMsvmVirtualSystemSettingDataList(priv, &query,
-                                                  &virtualSystemSettingData) < 0) {
+                                                  &virtualSystemSettingData) < 0)
         goto cleanup;
-    }

     if (virtualSystemSettingData == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -840,9 +811,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
                       virtualSystemSettingData->data->InstanceID);

     if (hypervGetMsvmProcessorSettingDataList(priv, &query,
-                                              &processorSettingData) < 0) {
+                                              &processorSettingData) < 0)
         goto cleanup;
-    }

     if (processorSettingData == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -861,9 +831,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
                       virtualSystemSettingData->data->InstanceID);

     if (hypervGetMsvmMemorySettingDataList(priv, &query,
-                                           &memorySettingData) < 0) {
+                                           &memorySettingData) < 0)
         goto cleanup;
-    }


     if (memorySettingData == NULL) {
@@ -932,9 +901,8 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn
     int count = 0;
     size_t i;

-    if (maxnames == 0) {
+    if (maxnames == 0)
         return 0;
-    }

     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
     virBufferAddLit(&query, "where ");
@@ -943,9 +911,8 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_INACTIVE);

     if (hypervGetMsvmComputerSystemList(priv, &query,
-                                        &computerSystemList) < 0) {
+                                        &computerSystemList) < 0)
         goto cleanup;
-    }

     for (computerSystem = computerSystemList; computerSystem != NULL;
          computerSystem = computerSystem->next) {
@@ -954,18 +921,16 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn

         ++count;

-        if (count >= maxnames) {
+        if (count >= maxnames)
             break;
-        }
     }

     success = true;

  cleanup:
     if (!success) {
-        for (i = 0; i < count; ++i) {
+        for (i = 0; i < count; ++i)
             VIR_FREE(names[i]);
-        }

         count = -1;
     }
@@ -994,14 +959,12 @@ hypervConnectNumOfDefinedDomains(virConnectPtr conn)
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_INACTIVE);

     if (hypervGetMsvmComputerSystemList(priv, &query,
-                                        &computerSystemList) < 0) {
+                                        &computerSystemList) < 0)
         goto cleanup;
-    }

     for (computerSystem = computerSystemList; computerSystem != NULL;
-         computerSystem = computerSystem->next) {
+         computerSystem = computerSystem->next)
         ++count;
-    }

     success = true;

@@ -1022,9 +985,8 @@ hypervDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@@ -1103,9 +1065,8 @@ hypervDomainIsActive(virDomainPtr domain)
     hypervPrivate *priv = domain->conn->privateData;
     Msvm_ComputerSystem *computerSystem = NULL;

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;

@@ -1144,9 +1105,8 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags)

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
         in_transition) {
@@ -1175,9 +1135,8 @@ hypervDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     result = computerSystem->data->EnabledState ==
              MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0;
@@ -1199,9 +1158,8 @@ hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags)

     virCheckFlags(0, -1);

-    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
+    if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
         goto cleanup;
-    }

     if (computerSystem->data->EnabledState !=
         MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
@@ -1338,9 +1296,8 @@ hypervConnectListAllDomains(virConnectPtr conn,

  cleanup:
     if (doms) {
-        for (i = 0; i < count; ++i) {
+        for (i = 0; i < count; ++i)
             virDomainFree(doms[i]);
-        }

         VIR_FREE(doms);
     }
@@ -1424,9 +1381,8 @@ hypervRegister(void)
         hypervStorageRegister() < 0 ||
         hypervDeviceRegister() < 0 ||
         hypervSecretRegister() < 0 ||
-        hypervNWFilterRegister() < 0) {
+        hypervNWFilterRegister() < 0)
         return -1;
-    }

     /* Forward openwsman errors and warnings to libvirt's logging */
     debug_add_handler(hypervDebugHandler, DEBUG_LEVEL_WARNING, NULL);
diff --git a/src/hyperv/hyperv_interface_driver.c b/src/hyperv/hyperv_interface_driver.c
index b93cf30..a70b49e 100644
--- a/src/hyperv/hyperv_interface_driver.c
+++ b/src/hyperv/hyperv_interface_driver.c
@@ -40,9 +40,8 @@ hypervInterfaceOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->interfacePrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c
index 6f54f44..f9131c9 100644
--- a/src/hyperv/hyperv_network_driver.c
+++ b/src/hyperv/hyperv_network_driver.c
@@ -40,9 +40,8 @@ hypervNetworkOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->networkPrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_nwfilter_driver.c b/src/hyperv/hyperv_nwfilter_driver.c
index a82db92..aa4934a 100644
--- a/src/hyperv/hyperv_nwfilter_driver.c
+++ b/src/hyperv/hyperv_nwfilter_driver.c
@@ -40,9 +40,8 @@ hypervNWFilterOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->nwfilterPrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_secret_driver.c b/src/hyperv/hyperv_secret_driver.c
index 8176484..c503a11 100644
--- a/src/hyperv/hyperv_secret_driver.c
+++ b/src/hyperv/hyperv_secret_driver.c
@@ -40,9 +40,8 @@ hypervSecretOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->secretPrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_storage_driver.c b/src/hyperv/hyperv_storage_driver.c
index af3cca4..035adcf 100644
--- a/src/hyperv/hyperv_storage_driver.c
+++ b/src/hyperv/hyperv_storage_driver.c
@@ -40,9 +40,8 @@ hypervStorageOpen(virConnectPtr conn,
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);

-    if (conn->driver->no != VIR_DRV_HYPERV) {
+    if (conn->driver->no != VIR_DRV_HYPERV)
         return VIR_DRV_OPEN_DECLINED;
-    }

     conn->storagePrivateData = conn->privateData;

diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index ebf9eac..73b3269 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -78,9 +78,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
     result = 0;

  cleanup:
-    if (result < 0) {
+    if (result < 0)
         hypervFreeParsedUri(parsedUri);
-    }

     return result;
 }
@@ -90,9 +89,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
 void
 hypervFreeParsedUri(hypervParsedUri **parsedUri)
 {
-    if (parsedUri == NULL || *parsedUri == NULL) {
+    if (parsedUri == NULL || *parsedUri == NULL)
         return;
-    }

     VIR_FREE((*parsedUri)->transport);

diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 3027601..537ac86 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -157,9 +157,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,

     response = wsmc_action_enumerate(priv->client, root, options, filter);

-    if (hyperyVerifyResponse(priv->client, response, "enumeration") < 0) {
+    if (hyperyVerifyResponse(priv->client, response, "enumeration") < 0)
         goto cleanup;
-    }

     enumContext = wsmc_get_enum_context(response);

@@ -170,9 +169,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
         response = wsmc_action_pull(priv->client, resourceUri, options,
                                     filter, enumContext);

-        if (hyperyVerifyResponse(priv->client, response, "pull") < 0) {
+        if (hyperyVerifyResponse(priv->client, response, "pull") < 0)
             goto cleanup;
-        }

         node = ws_xml_get_soap_body(response);

@@ -198,9 +196,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
             goto cleanup;
         }

-        if (ws_xml_get_child(node, 0, resourceUri, className) == NULL) {
+        if (ws_xml_get_child(node, 0, resourceUri, className) == NULL)
             break;
-        }

         data = ws_deserialize(serializerContext, node, serializerInfo,
                               className, resourceUri, NULL, 0, 0);
@@ -240,22 +237,19 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
     result = 0;

  cleanup:
-    if (options != NULL) {
+    if (options != NULL)
         wsmc_options_destroy(options);
-    }

-    if (filter != NULL) {
+    if (filter != NULL)
         filter_destroy(filter);
-    }

     if (data != NULL) {
 #if WS_SERIALIZER_FREE_MEM_WORKS
         /* FIXME: ws_serializer_free_mem is broken in openwsman <= 2.2.6,
          *        see hypervFreeObject for a detailed explanation. */
         if (ws_serializer_free_mem(serializerContext, data,
-                                   serializerInfo) < 0) {
+                                   serializerInfo) < 0)
             VIR_ERROR(_("Could not free deserialized data"));
-        }
 #endif
     }

@@ -275,9 +269,8 @@ hypervFreeObject(hypervPrivate *priv ATTRIBUTE_UNUSED, hypervObject *object)
     WsSerializerContextH serializerContext;
 #endif

-    if (object == NULL) {
+    if (object == NULL)
         return;
-    }

 #if WS_SERIALIZER_FREE_MEM_WORKS
     serializerContext = wsmc_get_serialization_context(priv->client);
@@ -294,9 +287,8 @@ hypervFreeObject(hypervPrivate *priv ATTRIBUTE_UNUSED, hypervObject *object)
          *        memory leak, but just in piling up unused memory until
          *        the connection is closed. */
         if (ws_serializer_free_mem(serializerContext, object->data,
-                                   object->serializerInfo) < 0) {
+                                   object->serializerInfo) < 0)
             VIR_ERROR(_("Could not free deserialized data"));
-        }
 #endif

         VIR_FREE(object);
@@ -431,9 +423,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
     response = wsmc_action_invoke(priv->client, MSVM_COMPUTERSYSTEM_RESOURCE_URI,
                                   options, "RequestStateChange", NULL);

-    if (hyperyVerifyResponse(priv->client, response, "invocation") < 0) {
+    if (hyperyVerifyResponse(priv->client, response, "invocation") < 0)
         goto cleanup;
-    }

     /* Check return value */
     returnValue = ws_xml_get_xpath_value(response, (char *)"/s:Envelope/s:Body/p:RequestStateChange_OUTPUT/p:ReturnValue");
@@ -468,9 +459,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
             virBufferAddLit(&query, MSVM_CONCRETEJOB_WQL_SELECT);
             virBufferAsprintf(&query, "where InstanceID = \"%s\"", instanceID);

-            if (hypervGetMsvmConcreteJobList(priv, &query, &concreteJob) < 0) {
+            if (hypervGetMsvmConcreteJobList(priv, &query, &concreteJob) < 0)
                 goto cleanup;
-            }

             if (concreteJob == NULL) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -521,9 +511,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
     result = 0;

  cleanup:
-    if (options != NULL) {
+    if (options != NULL)
         wsmc_options_destroy(options);
-    }

     ws_xml_destroy_doc(response);
     VIR_FREE(selector);
@@ -576,9 +565,8 @@ bool
 hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *computerSystem,
                                  bool *in_transition)
 {
-    if (in_transition != NULL) {
+    if (in_transition != NULL)
         *in_transition = false;
-    }

     switch (computerSystem->data->EnabledState) {
       case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_UNKNOWN:
@@ -602,9 +590,8 @@ hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *computerSystem,
       case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_STOPPING:
       case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSING:
       case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_RESUMING:
-        if (in_transition != NULL) {
+        if (in_transition != NULL)
             *in_transition = true;
-        }

         return true;

@@ -634,9 +621,8 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn,

     *domain = virGetDomain(conn, computerSystem->data->ElementName, uuid);

-    if (*domain == NULL) {
+    if (*domain == NULL)
         return -1;
-    }

     if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
         (*domain)->id = computerSystem->data->ProcessID;
@@ -667,9 +653,8 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain,
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
     virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);

-    if (hypervGetMsvmComputerSystemList(priv, &query, computerSystem) < 0) {
+    if (hypervGetMsvmComputerSystemList(priv, &query, computerSystem) < 0)
         return -1;
-    }

     if (*computerSystem == NULL) {
         virReportError(VIR_ERR_NO_DOMAIN,
-- 
2.1.3




More information about the libvir-list mailing list