[libvirt] [PATCH 04/29] esx: Add spaces after casts

Martin Kletzander mkletzan at redhat.com
Mon Apr 23 12:44:32 UTC 2018


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/esx/esx_driver.c               | 18 +++++------
 src/esx/esx_interface_driver.c     |  2 +-
 src/esx/esx_network_driver.c       |  2 +-
 src/esx/esx_storage_backend_vmfs.c |  6 ++--
 src/esx/esx_stream.c               |  2 +-
 src/esx/esx_util.c                 |  2 +-
 src/esx/esx_vi.c                   | 16 +++++-----
 src/esx/esx_vi_types.c             | 48 +++++++++++++++---------------
 8 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index c682c800caaf..7bc867b9e8a2 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -168,7 +168,7 @@ esxParseVMXFileName(const char *fileName, void *opaque)
                 goto cleanup;
             }
 
-            tmp = (char *)STRSKIP(fileName, hostMount->mountInfo->path);
+            tmp = (char *) STRSKIP(fileName, hostMount->mountInfo->path);
 
             if (!tmp)
                 continue;
@@ -2268,8 +2268,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
             querySpec->entity = virtualMachine->obj;
             querySpec->maxSample->value = 1;
             querySpec->metricId->counterId->value = priv->usedCpuTimeCounterId;
-            querySpec->metricId->instance = (char *)"";
-            querySpec->format = (char *)"normal";
+            querySpec->metricId->instance = (char *) "";
+            querySpec->format = (char *) "normal";
 
             if (esxVI_QueryPerf(priv->host, querySpec,
                                 &perfEntityMetricBaseList) < 0) {
@@ -2308,7 +2308,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
                     for (value = perfMetricIntSeries->value;
                          value;
                          value = value->_next) {
-                        VIR_DEBUG("value %lld", (long long int)value->value);
+                        VIR_DEBUG("value %lld", (long long int) value->value);
                     }
                 }
             }
@@ -2757,7 +2757,7 @@ esxConnectDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
     }
 
     data.ctx = priv->primary;
-    data.datastorePathWithoutFileName = (char *)"[?] ?";
+    data.datastorePathWithoutFileName = (char *) "[?] ?";
 
     ctx.opaque = &data;
     ctx.parseFileName = esxParseVMXFileName;
@@ -3416,9 +3416,9 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
     newPowerInfo->startOrder->value = -1; /* no specific start order */
     newPowerInfo->startDelay->value = -1; /* use system default */
     newPowerInfo->waitForHeartbeat = esxVI_AutoStartWaitHeartbeatSetting_SystemDefault;
-    newPowerInfo->startAction = autostart ? (char *)"powerOn" : (char *)"none";
+    newPowerInfo->startAction = autostart ? (char *) "powerOn" : (char *) "none";
     newPowerInfo->stopDelay->value = -1; /* use system default */
-    newPowerInfo->stopAction = (char *)"none";
+    newPowerInfo->stopAction = (char *) "none";
 
     if (esxVI_AutoStartPowerInfo_AppendToList(&spec->powerInfo,
                                               newPowerInfo) < 0) {
@@ -3865,12 +3865,12 @@ esxDomainMigratePerform(virDomainPtr domain,
 
     resourcePool._next = NULL;
     resourcePool._type = esxVI_Type_ManagedObjectReference;
-    resourcePool.type = (char *)"ResourcePool";
+    resourcePool.type = (char *) "ResourcePool";
     resourcePool.value = path_resourcePool;
 
     hostSystem._next = NULL;
     hostSystem._type = esxVI_Type_ManagedObjectReference;
-    hostSystem.type = (char *)"HostSystem";
+    hostSystem.type = (char *) "HostSystem";
     hostSystem.value = path_hostSystem;
 
     /* Lookup VirtualMachine */
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index e3b41164e7ba..00affaa27e93 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -205,7 +205,7 @@ esxInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
 
     /* FIXME: Add support for IPv6, requires to use vSphere API 4.0 */
     if (physicalNic->spec->ip) {
-        protocol.family = (char *)"ipv4";
+        protocol.family = (char *) "ipv4";
 
         if (physicalNic->spec->ip->dhcp == esxVI_Boolean_True)
             protocol.dhcp = 1;
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index b19c06a4cbf8..e9a580002458 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -366,7 +366,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
         }
 
         hostVirtualSwitchSpec->bridge =
-          (esxVI_HostVirtualSwitchBridge *)hostVirtualSwitchBondBridge;
+          (esxVI_HostVirtualSwitchBridge *) hostVirtualSwitchBondBridge;
 
         /* Lookup PhysicalNic list and match by name to get key */
         if (esxVI_LookupPhysicalNicList(priv->primary, &physicalNicList) < 0)
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index 940e5d1f0685..8c3a82b020dc 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -951,13 +951,13 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
              * "A preallocated disk has all space allocated at creation time
              *  and the space is zeroed on demand as the space is used."
              */
-            virtualDiskSpec->diskType = (char *)"preallocated";
+            virtualDiskSpec->diskType = (char *) "preallocated";
         } else if (def->target.allocation == 0) {
             /*
              * "Space required for thin-provisioned virtual disk is allocated
              *  and zeroed on demand as the space is used."
              */
-            virtualDiskSpec->diskType = (char *)"thin";
+            virtualDiskSpec->diskType = (char *) "thin";
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Unsupported capacity-to-allocation relation"));
@@ -969,7 +969,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
          * way to let the user specify it in the volume XML config. Therefore,
          * default to 'lsilogic' here.
          */
-        virtualDiskSpec->adapterType = (char *)"lsilogic";
+        virtualDiskSpec->adapterType = (char *) "lsilogic";
 
         virtualDiskSpec->capacityKb->value =
           VIR_DIV_UP(def->target.capacity, 1024); /* Scale from byte to kilobyte */
diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c
index b820b38ee24b..3bc2e36ee964 100644
--- a/src/esx/esx_stream.c
+++ b/src/esx/esx_stream.c
@@ -219,7 +219,7 @@ esxStreamSend(virStreamPtr stream, const char *data, size_t nbytes)
 
     virMutexLock(&priv->curl->lock);
 
-    priv->buffer = (char *)data;
+    priv->buffer = (char *) data;
     priv->buffer_size = nbytes;
     priv->buffer_used = nbytes;
 
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 2dd9f7856988..5ad24fb1b76d 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -250,7 +250,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
     preliminaryDirectoryAndFileName = strtok_r(NULL, "", &saveptr);
 
     if (!preliminaryDirectoryAndFileName) {
-        preliminaryDirectoryAndFileName = (char *)"";
+        preliminaryDirectoryAndFileName = (char *) "";
     } else {
         preliminaryDirectoryAndFileName +=
           strspn(preliminaryDirectoryAndFileName, " ");
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 43ff7ea0488d..d922794fdf6b 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -42,7 +42,7 @@
 VIR_LOG_INIT("esx.esx_vi");
 
 #define ESX_VI__SOAP__RESPONSE_XPATH(_type) \
-    ((char *)"/soapenv:Envelope/soapenv:Body/" \
+    ((char *) "/soapenv:Envelope/soapenv:Body/" \
                "vim:"_type"Response/vim:returnval")
 
 
@@ -121,7 +121,7 @@ ESX_VI__TEMPLATE__FREE(CURL,
 static size_t
 esxVI_CURL_ReadString(char *data, size_t size, size_t nmemb, void *userdata)
 {
-    const char *content = *(const char **)userdata;
+    const char *content = *(const char **) userdata;
     size_t available = 0;
     size_t requested = size * nmemb;
 
@@ -138,7 +138,7 @@ esxVI_CURL_ReadString(char *data, size_t size, size_t nmemb, void *userdata)
 
     memcpy(data, content, requested);
 
-    *(const char **)userdata = content + requested;
+    *(const char **) userdata = content + requested;
 
     return requested;
 }
@@ -483,7 +483,7 @@ esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
     size_t i;
     esxVI_SharedCURL *shared = userptr;
 
-    switch ((int)data) {
+    switch ((int) data) {
       case CURL_LOCK_DATA_SHARE:
         i = 0;
         break;
@@ -497,7 +497,7 @@ esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
         break;
 
       default:
-        VIR_ERROR(_("Trying to lock unknown SharedCURL lock %d"), (int)data);
+        VIR_ERROR(_("Trying to lock unknown SharedCURL lock %d"), (int) data);
         return;
     }
 
@@ -511,7 +511,7 @@ esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
     size_t i;
     esxVI_SharedCURL *shared = userptr;
 
-    switch ((int)data) {
+    switch ((int) data) {
       case CURL_LOCK_DATA_SHARE:
         i = 0;
         break;
@@ -525,7 +525,7 @@ esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
         break;
 
       default:
-        VIR_ERROR(_("Trying to unlock unknown SharedCURL lock %d"), (int)data);
+        VIR_ERROR(_("Trying to unlock unknown SharedCURL lock %d"), (int) data);
         return;
     }
 
@@ -2238,7 +2238,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
     if (esxVI_PropertySpec_Alloc(&propertySpec) < 0)
         goto cleanup;
 
-    propertySpec->type = (char *)type;
+    propertySpec->type = (char *) type;
     propertySpec->pathSet = propertyNameList;
 
     if (esxVI_PropertyFilterSpec_Alloc(&propertyFilterSpec) < 0 ||
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index ec7fda986570..5ad0d469d073 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -131,7 +131,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
     int \
     esxVI_##_type##_AppendToList(esxVI_##_type **list,  esxVI_##_type *item) \
     { \
-        return esxVI_List_Append((esxVI_List **)list, (esxVI_List *)item); \
+        return esxVI_List_Append((esxVI_List **) list, (esxVI_List *) item); \
     }
 
 
@@ -142,7 +142,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
                                  esxVI_##_type *srcList) \
     { \
         return esxVI_List_DeepCopy \
-                 ((esxVI_List **)destList, (esxVI_List *)srcList, \
+                 ((esxVI_List **) destList, (esxVI_List *) srcList, \
                   (esxVI_List_DeepCopyFunc)esxVI_##_type##_DeepCopy, \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free); \
     }
@@ -155,7 +155,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
                                         esxVI_##_type **list) \
     { \
         return esxVI_List_CastFromAnyType \
-                 (anyType, (esxVI_List **)list, \
+                 (anyType, (esxVI_List **) list, \
                   (esxVI_List_CastFromAnyTypeFunc) \
                     esxVI_##_type##_CastFromAnyType, \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free); \
@@ -168,7 +168,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
     esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element, \
                                   virBufferPtr output) \
     { \
-        return esxVI_List_Serialize((esxVI_List *)list, element, output, \
+        return esxVI_List_Serialize((esxVI_List *) list, element, output, \
                                     (esxVI_List_SerializeFunc) \
                                       esxVI_##_type##_Serialize); \
     }
@@ -180,7 +180,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
     esxVI_##_type##_DeserializeList(xmlNodePtr node, esxVI_##_type **list) \
     { \
         return esxVI_List_Deserialize \
-                 (node, (esxVI_List **)list, \
+                 (node, (esxVI_List **) list, \
                   (esxVI_List_DeserializeFunc)esxVI_##_type##_Deserialize, \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free); \
     }
@@ -352,7 +352,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
             return -1; \
         } \
  \
-        string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \
+        string = (char *) xmlNodeListGetString(node->doc, node->children, 1); \
  \
         if (!string) { \
             virReportError(VIR_ERR_INTERNAL_ERROR, \
@@ -512,7 +512,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
                                     esxVI_##_type *value) \
     { \
         return esxVI_Enumeration_CastFromAnyType \
-                 (&_esxVI_##_type##_Enumeration, anyType, (int *)value); \
+                 (&_esxVI_##_type##_Enumeration, anyType, (int *) value); \
     }
 
 
@@ -533,7 +533,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
     esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type *value) \
     { \
         return esxVI_Enumeration_Deserialize(&_esxVI_##_type##_Enumeration, \
-                                             node, (int *)value); \
+                                             node, (int *) value); \
     }
 
 
@@ -544,7 +544,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
 
 #define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type, \
                                    _dispatch,  _error_return) \
-    switch ((int)_actual_type) { \
+    switch ((int) _actual_type) { \
       _dispatch \
  \
       case esxVI_Type_##__type: \
@@ -604,7 +604,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
 
 
 #define ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \
-    if (((esxVI_Object *)item)->_type == esxVI_Type_##__type) { \
+    if (((esxVI_Object *) item)->_type == esxVI_Type_##__type) { \
         return item; \
     }
 
@@ -690,7 +690,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
           return -1; \
       } \
  \
-      switch ((int)type) { \
+      switch ((int) type) { \
         _dispatch \
  \
         case esxVI_Type_##__type: \
@@ -719,7 +719,7 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType,
         return -1;
     }
 
-    type = (char *)xmlGetNsProp
+    type = (char *) xmlGetNsProp
                      (node, BAD_CAST "type",
                       BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
 
@@ -967,7 +967,7 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
         goto failure;
     }
 
-    switch ((int)src->type) {
+    switch ((int) src->type) {
       case esxVI_Type_Boolean:
         (*dest)->boolean = src->boolean;
         break;
@@ -1026,7 +1026,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
     }
 
     (*anyType)->other =
-      (char *)xmlGetNsProp
+      (char *) xmlGetNsProp
                 (node, BAD_CAST "type",
                  BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
 
@@ -1046,7 +1046,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
     }
 
     (*anyType)->value =
-      (char *)xmlNodeListGetString(node->doc, node->children, 1);
+      (char *) xmlNodeListGetString(node->doc, node->children, 1);
 
     if (!(*anyType)->value && VIR_STRDUP((*anyType)->value, "") < 0)
         goto failure;
@@ -1071,7 +1071,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
             (*anyType)->_name = number; \
         } while (0)
 
-    switch ((int)(*anyType)->type) {
+    switch ((int) (*anyType)->type) {
       case esxVI_Type_Boolean:
         if (STREQ((*anyType)->value, "true")) {
             (*anyType)->boolean = esxVI_Boolean_True;
@@ -1299,7 +1299,7 @@ esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
         return -1;
     }
 
-    *value = (char *)xmlNodeListGetString(node->doc, node->children, 1);
+    *value = (char *) xmlNodeListGetString(node->doc, node->children, 1);
 
     return *value ? 0 : VIR_STRDUP(*value, "");
 }
@@ -1339,7 +1339,7 @@ ESX_VI__TEMPLATE__LIST__DEEP_COPY(Byte)
 /* esxVI_Byte_Serialize */
 ESX_VI__TEMPLATE__SERIALIZE(Byte,
 {
-    virBufferAsprintf(output, "%d", (int)item->value);
+    virBufferAsprintf(output, "%d", (int) item->value);
 })
 
 /* esxVI_Byte_SerializeList */
@@ -1383,7 +1383,7 @@ ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(Int)
 /* esxVI_Int_Serialize */
 ESX_VI__TEMPLATE__SERIALIZE(Int,
 {
-    virBufferAsprintf(output, "%d", (int)item->value);
+    virBufferAsprintf(output, "%d", (int) item->value);
 })
 
 /* esxVI_Int_SerializeList */
@@ -1427,7 +1427,7 @@ ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(Long)
 /* esxVI_Long_Serialize */
 ESX_VI__TEMPLATE__SERIALIZE(Long,
 {
-    virBufferAsprintf(output, "%lld", (long long int)item->value);
+    virBufferAsprintf(output, "%lld", (long long int) item->value);
 })
 
 /* esxVI_Long_SerializeList */
@@ -1481,7 +1481,7 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
         return -1;
 
     (*dateTime)->value =
-      (char *)xmlNodeListGetString(node->doc, node->children, 1);
+      (char *) xmlNodeListGetString(node->doc, node->children, 1);
 
     if (!(*dateTime)->value) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1653,7 +1653,7 @@ esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault)
         return -1;
 
     (*methodFault)->_actualType =
-      (char *)xmlGetNsProp(node, BAD_CAST "type",
+      (char *) xmlGetNsProp(node, BAD_CAST "type",
                            BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
 
     if (!(*methodFault)->_actualType) {
@@ -1747,7 +1747,7 @@ esxVI_ManagedObjectReference_Deserialize
         return -1;
 
     (*managedObjectReference)->type =
-      (char *)xmlGetNoNsProp(node, BAD_CAST "type");
+      (char *) xmlGetNoNsProp(node, BAD_CAST "type");
 
     if (!(*managedObjectReference)->type) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1824,7 +1824,7 @@ ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(Event)
 ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(Event, /* nothing */,
 {
     (*ptrptr)->_actualType =
-      (char *)xmlGetNsProp(node, BAD_CAST "type",
+      (char *) xmlGetNsProp(node, BAD_CAST "type",
                            BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
 
     if (!(*ptrptr)->_actualType) {
-- 
2.17.0




More information about the libvir-list mailing list