[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] ESX [07/12]: Whitespace cleanup



Subject says it all.
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 745b744..8194b49 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -752,13 +752,13 @@ esxGetHostname(virConnectPtr conn)
         }
     }
 
-    if (hostName == NULL || strlen (hostName) < 1) {
+    if (hostName == NULL || strlen(hostName) < 1) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Missing or empty 'hostName' property");
         goto failure;
     }
 
-    if (domainName == NULL || strlen (domainName) < 1) {
+    if (domainName == NULL || strlen(domainName) < 1) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Missing or empty 'domainName' property");
         goto failure;
@@ -800,7 +800,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
     int32_t numaInfo_numNodes = 0;
     char *ptr = NULL;
 
-    memset (nodeinfo, 0, sizeof (virNodeInfo));
+    memset(nodeinfo, 0, sizeof(virNodeInfo));
 
     if (priv->phantom) {
         ESX_ERROR(conn, VIR_ERR_OPERATION_INVALID,
@@ -891,11 +891,11 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
 
             /* Strip the string to fit more relevant information in 32 chars */
             while (*ptr != '\0') {
-                if (STRPREFIX (ptr, "  ")) {
-                    memmove(ptr, ptr + 1, strlen (ptr + 1) + 1);
+                if (STRPREFIX(ptr, "  ")) {
+                    memmove(ptr, ptr + 1, strlen(ptr + 1) + 1);
                     continue;
                 } else if (STRPREFIX(ptr, "(R)") || STRPREFIX(ptr, "(C)")) {
-                    memmove(ptr, ptr + 3, strlen (ptr + 3) + 1);
+                    memmove(ptr, ptr + 3, strlen(ptr + 3) + 1);
                     continue;
                 } else if (STRPREFIX(ptr, "(TM)")) {
                     memmove(ptr, ptr + 4, strlen(ptr + 4) + 1);
@@ -905,9 +905,9 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
                 ++ptr;
             }
 
-            strncpy (nodeinfo->model, dynamicProperty->val->string,
-                     sizeof (nodeinfo->model) - 1);
-            nodeinfo->model[sizeof (nodeinfo->model) - 1] = '\0';
+            strncpy(nodeinfo->model, dynamicProperty->val->string,
+                    sizeof(nodeinfo->model) - 1);
+            nodeinfo->model[sizeof(nodeinfo->model) - 1] = '\0';
         } else {
             VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
         }
@@ -1196,7 +1196,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         }
 
         if (memcmp(uuid, uuid_candidate,
-                   VIR_UUID_BUFLEN * sizeof (unsigned char)) != 0) {
+                   VIR_UUID_BUFLEN * sizeof(unsigned char)) != 0) {
             continue;
         }
 
@@ -2732,7 +2732,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
          dynamicProperty != NULL && mask != 7 && i < 3;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "config.cpuAllocation.reservation") &&
-            !(mask & (1 << 0))) {
+            ! (mask & (1 << 0))) {
             snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s",
                       "reservation");
 
@@ -2748,7 +2748,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
             ++i;
         } else if (STREQ(dynamicProperty->name,
                          "config.cpuAllocation.limit") &&
-                   !(mask & (1 << 1))) {
+                   ! (mask & (1 << 1))) {
             snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s",
                       "limit");
 
@@ -2764,7 +2764,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
             ++i;
         } else if (STREQ(dynamicProperty->name,
                          "config.cpuAllocation.shares") &&
-                   !(mask & (1 << 2))) {
+                   ! (mask & (1 << 2))) {
             snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s",
                       "shares");
 
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 38014de..7130a41 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -271,7 +271,7 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
     struct addrinfo *result = NULL;
     int errcode;
 
-    memset(&hints, 0, sizeof (struct addrinfo));
+    memset(&hints, 0, sizeof(struct addrinfo));
 
     hints.ai_flags = AI_ADDRCONFIG;
     hints.ai_family = AF_INET;
@@ -455,12 +455,12 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
 
 int
 esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
-                         const char *name, int *boolval, int default_,
+                         const char *name, int *boolean_, int default_,
                          int optional)
 {
     virConfValuePtr value;
 
-    *boolval = default_;
+    *boolean_ = default_;
     value = virConfGetValue(conf, name);
 
     if (value == NULL) {
@@ -485,9 +485,9 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
         }
 
         if (STRCASEEQ(value->str, "true")) {
-            *boolval = 1;
+            *boolean_ = 1;
         } else if (STRCASEEQ(value->str, "false")) {
-            *boolval = 0;
+            *boolean_ = 0;
         } else {
             ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                       "Config entry '%s' must represent a boolean value "
@@ -506,7 +506,7 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
 
 
 int
-esxUtil_EqualSuffix(const char *string, const char* suffix)
+esxUtil_EqualSuffix(const char *string, const char *suffix)
 {
     int difference = (int)strlen(string) - (int)strlen(suffix);
 
diff --git a/src/esx/esx_util.h b/src/esx/esx_util.h
index 476e004..e4922c1 100644
--- a/src/esx/esx_util.h
+++ b/src/esx/esx_util.h
@@ -53,9 +53,9 @@ int esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
                           long long *number, long long default_, int optional);
 
 int esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
-                             const char *name, int *boolean, int default_,
+                             const char *name, int *boolean_, int default_,
                              int optional);
 
-int esxUtil_EqualSuffix(const char *string, const char* suffix);
+int esxUtil_EqualSuffix(const char *string, const char *suffix);
 
 #endif /* __ESX_UTIL_H__ */
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 32e9be3..0919774 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -82,7 +82,7 @@
     int                                                                       \
     esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr)         \
     {                                                                         \
-        return esxVI_Alloc(conn, (void **)ptrptr, sizeof (esxVI_##_type));    \
+        return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type));     \
     }
 
 #define ESX_VI__TEMPLATE__FREE(_type, _body)                                  \
@@ -765,6 +765,7 @@ esxVI_Enumeration_Deserialize(virConnectPtr conn,
 
   failure:
     result = -1;
+
     goto cleanup;
 }
 
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 09cdec3..d3d306e 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -66,7 +66,7 @@
     int                                                                       \
     esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr)         \
     {                                                                         \
-        return esxVI_Alloc(conn, (void **)ptrptr, sizeof (esxVI_##_type));    \
+        return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type));     \
     }
 
 
@@ -133,7 +133,7 @@
 #define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type)                              \
     int                                                                       \
     esxVI_##_type##_SerializeList(virConnectPtr conn, esxVI_##_type *list,    \
-                                  const char* element, virBufferPtr output,   \
+                                  const char *element, virBufferPtr output,   \
                                   esxVI_Boolean required)                     \
     {                                                                         \
         return esxVI_List_Serialize(conn, (esxVI_List *)list,                 \
@@ -291,7 +291,7 @@
         if (value < (_min) || value > (_max)) {                               \
             ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                        \
                          "Value '%s' is not representable as "_xsdType,       \
-                         (const char *) string);                              \
+                         (const char *)string);                               \
             goto failure;                                                     \
         }                                                                     \
                                                                               \
@@ -1010,7 +1010,6 @@ ESX_VI__TEMPLATE__SERIALIZE_EXTRA(Long, "xsd:long",
 /* esxVI_Long_SerializeList */
 ESX_VI__TEMPLATE__LIST__SERIALIZE(Long);
 
-
 /* esxVI_Long_Deserialize */
 ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX);
 
@@ -1394,7 +1393,7 @@ esxVI_ManagedObjectReference_Deserialize
     }
 
     if (expectedType != NULL &&
-        !STREQ(expectedType, (*managedObjectReference)->type)) {
+        STRNEQ(expectedType, (*managedObjectReference)->type)) {
         ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                      "Expected type '%s' but found '%s'", expectedType,
                      (*managedObjectReference)->type);
@@ -1615,7 +1614,7 @@ esxVI_TraversalSpec_Alloc(virConnectPtr conn,
                           esxVI_TraversalSpec **traversalSpec)
 {
     if (esxVI_Alloc(conn, (void **)traversalSpec,
-                    sizeof (esxVI_TraversalSpec)) < 0) {
+                    sizeof(esxVI_TraversalSpec)) < 0) {
         return -1;
     }
 
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index 8738ab3..32ccda6 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -1157,13 +1157,13 @@ int esxVI_PerfCounterInfo_DeserializeList
 struct _esxVI_PerfQuerySpec {
     esxVI_PerfQuerySpec *_next;                            /* optional */
 
-    esxVI_ManagedObjectReference* entity;                  /* required */
-    esxVI_DateTime* startTime;                             /* optional */
-    esxVI_DateTime* endTime;                               /* optional */
+    esxVI_ManagedObjectReference *entity;                  /* required */
+    esxVI_DateTime *startTime;                             /* optional */
+    esxVI_DateTime *endTime;                               /* optional */
     esxVI_Int *maxSample;                                  /* optional */
     esxVI_PerfMetricId *metricId;                          /* optional, list */
     esxVI_Int *intervalId;                                 /* optional */
-    char* format;                                          /* optional */ // FIXME: see PerfFormat
+    char *format;                                          /* optional */ // FIXME: see PerfFormat
 };
 
 int esxVI_PerfQuerySpec_Alloc(virConnectPtr conn,
@@ -1187,8 +1187,8 @@ int esxVI_PerfQuerySpec_SerializeList(virConnectPtr conn,
 struct _esxVI_PerfSampleInfo {
     esxVI_PerfSampleInfo *_next;                           /* optional */
 
-    esxVI_DateTime* timestamp;                             /* required */
-    esxVI_Int* interval;                                   /* required */
+    esxVI_DateTime *timestamp;                             /* required */
+    esxVI_Int *interval;                                   /* required */
 };
 
 int esxVI_PerfSampleInfo_Alloc(virConnectPtr conn,
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index 68a986f..ffcf591 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -431,14 +431,14 @@ esxVMX_IndexToDiskName(virConnectPtr conn, int idx, const char *prefix)
     char *name = NULL;
     size_t length = strlen(prefix);
 
-    if (length > sizeof (buffer) - 2 - 1) {
+    if (length > sizeof(buffer) - 2 - 1) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Disk name prefix '%s' is too long", prefix);
         return NULL;
     }
 
-    strncpy(buffer, prefix, sizeof (buffer) - 1);
-    buffer[sizeof (buffer) - 1] = '\0';
+    strncpy(buffer, prefix, sizeof(buffer) - 1);
+    buffer[sizeof(buffer) - 1] = '\0';
 
     if (idx < 26) {
         buffer[length] = 'a' + idx;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]