[libvirt] [PATCH 26/29] tests: Add spaces after casts

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


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 tests/commandtest.c            |  2 +-
 tests/esxutilstest.c           |  2 +-
 tests/libxlxml2domconfigtest.c |  2 +-
 tests/nwfilterebiptablestest.c |  2 +-
 tests/qemumonitortestutils.c   |  2 +-
 tests/qemuxml2argvmock.c       |  2 +-
 tests/securityselinuxhelper.c  |  2 +-
 tests/testutils.c              | 14 +++++++-------
 tests/viralloctest.c           |  4 ++--
 tests/vircgroupmock.c          | 18 +++++++++---------
 tests/virdbusmock.c            |  2 +-
 tests/virhashtest.c            |  2 +-
 tests/virhostdevtest.c         |  2 +-
 tests/virnetdaemontest.c       |  2 +-
 tests/virnetmessagetest.c      | 12 ++++++------
 tests/virnetsockettest.c       |  4 ++--
 tests/virnettlscontexttest.c   |  2 +-
 tests/virnettlshelpers.c       |  4 ++--
 tests/virnettlssessiontest.c   |  2 +-
 tests/virpcimock.c             |  2 +-
 tests/virrandommock.c          |  2 +-
 tests/virrotatingfiletest.c    |  6 +++---
 tests/virstringtest.c          |  4 ++--
 tests/virtypedparamtest.c      |  2 +-
 tests/xml2vmxtest.c            |  2 +-
 25 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/tests/commandtest.c b/tests/commandtest.c
index ad81c2a71219..8e7925bd95b9 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -1258,7 +1258,7 @@ mymain(void)
     test->running = true;
     virMutexUnlock(&test->lock);
 
-    environ = (char **)newenv;
+    environ = (char **) newenv;
 
 # define DO_TEST(NAME) \
     if (virTestRun("Command Exec " #NAME " test", \
diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c
index 7941f89b9a38..e051ed712714 100644
--- a/tests/esxutilstest.c
+++ b/tests/esxutilstest.c
@@ -130,7 +130,7 @@ testConvertDateTimeToCalendarTime(const void *data ATTRIBUTE_UNUSED)
     long long calendarTime;
 
     for (i = 0; i < ARRAY_CARDINALITY(times); ++i) {
-        dateTime.value = (char *)times[i].dateTime;
+        dateTime.value = (char *) times[i].dateTime;
 
         if (esxVI_DateTime_ConvertToCalendarTime(&dateTime,
                                                  &calendarTime) < 0) {
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index d9287b59a811..b8d4121fa857 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -73,7 +73,7 @@ testCompareXMLToDomConfig(const char *xmlfile,
 
     cfg->caps = caps;
 
-    if (!(log = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0)))
+    if (!(log = (xentoollog_logger *) xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0)))
         goto cleanup;
 
     /* for testing nested HVM */
diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c
index 607342330458..a17744f060ac 100644
--- a/tests/nwfilterebiptablestest.c
+++ b/tests/nwfilterebiptablestest.c
@@ -414,7 +414,7 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque ATTRIBUTE_UNUSED)
         .valType = NWFILTER_VALUE_TYPE_ARRAY,
         .u = {
             .array = {
-                .values = (char **)servers,
+                .values = (char **) servers,
                 .nValues = 3,
             }
         }
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 62f68ee69992..4b6682914634 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1153,7 +1153,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt,
 
     memset(src, 0, sizeof(*src));
     src->type = VIR_DOMAIN_CHR_TYPE_UNIX;
-    src->data.nix.path = (char *)path;
+    src->data.nix.path = (char *) path;
     src->data.nix.listen = false;
     path = NULL;
 
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index adab5c91117f..371483d5e1d1 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -79,7 +79,7 @@ char *
 virTPMCreateCancelPath(const char *devpath)
 {
     char *path;
-    (void)devpath;
+    (void) devpath;
 
     ignore_value(VIR_STRDUP(path, "/sys/class/misc/tpm0/device/cancel"));
 
diff --git a/tests/securityselinuxhelper.c b/tests/securityselinuxhelper.c
index 22b6709554b4..e1e29648dc7e 100644
--- a/tests/securityselinuxhelper.c
+++ b/tests/securityselinuxhelper.c
@@ -308,7 +308,7 @@ selabel_open(unsigned int backend,
     /* struct selabel_handle is opaque; fake it */
     if (VIR_ALLOC(fake_handle) < 0)
         return NULL;
-    return (struct selabel_handle *)fake_handle;
+    return (struct selabel_handle *) fake_handle;
 }
 
 void selabel_close(struct selabel_handle *handle)
diff --git a/tests/testutils.c b/tests/testutils.c
index 4b13d112788a..641ef6f5418e 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -132,8 +132,8 @@ virTestShowTrace(void)
             strstr(info.dli_fname, ".so")) {
             if (virAsprintf(&cmd, ADDR2LINE " -f -e %s %p",
                             info.dli_fname,
-                            ((void*)((unsigned long long)testAllocStack[j]
-                                     - (unsigned long long)info.dli_fbase))) < 0)
+                            ((void*)((unsigned long long) testAllocStack[j]
+                                     - (unsigned long long) info.dli_fbase))) < 0)
                 continue;
         } else {
             if (virAsprintf(&cmd, ADDR2LINE " -f -e %s %p",
@@ -753,18 +753,18 @@ int virTestDifferenceBin(FILE *stream,
         end = length - 1;
 
     /* Show the trimmed differences */
-    fprintf(stream, "\nExpect [ Region %d-%d", (int)start, (int)end);
+    fprintf(stream, "\nExpect [ Region %d-%d", (int) start, (int) end);
     for (i = start; i < end; i++) {
         if ((i % 4) == 0)
             fprintf(stream, "\n    ");
-        fprintf(stream, "0x%02x, ", ((int)expect[i])&0xff);
+        fprintf(stream, "0x%02x, ", ((int) expect[i])&0xff);
     }
     fprintf(stream, "]\n");
-    fprintf(stream, "Actual [ Region %d-%d", (int)start, (int)end);
+    fprintf(stream, "Actual [ Region %d-%d", (int) start, (int) end);
     for (i = start; i < end; i++) {
         if ((i % 4) == 0)
             fprintf(stream, "\n    ");
-        fprintf(stream, "0x%02x, ", ((int)actual[i])&0xff);
+        fprintf(stream, "0x%02x, ", ((int) actual[i])&0xff);
     }
     fprintf(stream, "]\n");
 
@@ -1122,7 +1122,7 @@ int virTestMain(int argc,
     virResetLastError();
     if (!virTestGetVerbose() && ret != EXIT_AM_SKIP) {
         if (testCounter == 0 || testCounter % 40)
-            fprintf(stderr, "%*s", 40 - (int)(testCounter % 40), "");
+            fprintf(stderr, "%*s", 40 - (int) (testCounter % 40), "");
         fprintf(stderr, " %-3zu %s\n", testCounter, ret == 0 ? "OK" : "FAIL");
     }
     virLogReset();
diff --git a/tests/viralloctest.c b/tests/viralloctest.c
index 27cbdcbbe46f..ba184997762d 100644
--- a/tests/viralloctest.c
+++ b/tests/viralloctest.c
@@ -331,7 +331,7 @@ testInsertArray(const void *opaque ATTRIBUTE_UNUSED)
     testDummyStruct **t;
     size_t nt = 10, i;
     int ret = -1;
-    testDummyStruct *n = (void *)0xff;
+    testDummyStruct *n = (void *) 0xff;
 
     if (VIR_ALLOC_N(t, nt) < 0)
         return -1;
@@ -361,7 +361,7 @@ testInsertArray(const void *opaque ATTRIBUTE_UNUSED)
     }
 
     for (i = 0; i < nt; i++) {
-        void *expect = i == 3 ? (void *)0xff : (void*)0x50;
+        void *expect = i == 3 ? (void *) 0xff : (void*)0x50;
         if (t[i] != expect) {
             fprintf(stderr, "Expecting %p at offset %zu not %p\n",
                     expect, i, t[i]);
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index 56337c2f3e09..96659ecd6a55 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -467,13 +467,13 @@ FILE *fopen(const char *path, const char *mode)
     if (STREQ(path, "/proc/mounts")) {
         if (STREQ(mode, "r")) {
             if (allinone)
-                return fmemopen((void *)procmountsallinone,
+                return fmemopen((void *) procmountsallinone,
                                 strlen(procmountsallinone), mode);
             else if (logind)
-                return fmemopen((void *)procmountslogind,
+                return fmemopen((void *) procmountslogind,
                                 strlen(procmountslogind), mode);
             else
-                return fmemopen((void *)procmounts, strlen(procmounts), mode);
+                return fmemopen((void *) procmounts, strlen(procmounts), mode);
         } else {
             errno = EACCES;
             return NULL;
@@ -482,13 +482,13 @@ FILE *fopen(const char *path, const char *mode)
     if (STREQ(path, "/proc/cgroups")) {
         if (STREQ(mode, "r")) {
             if (allinone)
-                return fmemopen((void *)proccgroupsallinone,
+                return fmemopen((void *) proccgroupsallinone,
                                 strlen(proccgroupsallinone), mode);
             else if (logind)
-                return fmemopen((void *)proccgroupslogind,
+                return fmemopen((void *) proccgroupslogind,
                                 strlen(proccgroupslogind), mode);
             else
-                return fmemopen((void *)proccgroups, strlen(proccgroups), mode);
+                return fmemopen((void *) proccgroups, strlen(proccgroups), mode);
         } else {
             errno = EACCES;
             return NULL;
@@ -497,13 +497,13 @@ FILE *fopen(const char *path, const char *mode)
     if (STREQ(path, "/proc/self/cgroup")) {
         if (STREQ(mode, "r")) {
             if (allinone)
-                return fmemopen((void *)procselfcgroupsallinone,
+                return fmemopen((void *) procselfcgroupsallinone,
                                 strlen(procselfcgroupsallinone), mode);
             else if (logind)
-                return fmemopen((void *)procselfcgroupslogind,
+                return fmemopen((void *) procselfcgroupslogind,
                                 strlen(procselfcgroupslogind), mode);
             else
-                return fmemopen((void *)procselfcgroups, strlen(procselfcgroups), mode);
+                return fmemopen((void *) procselfcgroups, strlen(procselfcgroups), mode);
         } else {
             errno = EACCES;
             return NULL;
diff --git a/tests/virdbusmock.c b/tests/virdbusmock.c
index a62689e91d5b..8786262e52ca 100644
--- a/tests/virdbusmock.c
+++ b/tests/virdbusmock.c
@@ -31,7 +31,7 @@ VIR_MOCK_STUB_VOID_ARGS(dbus_connection_set_change_sigpipe,
 
 
 VIR_MOCK_STUB_RET_ARGS(dbus_bus_get,
-                       DBusConnection *, (DBusConnection *)0x1,
+                       DBusConnection *, (DBusConnection *) 0x1,
                        DBusBusType, type,
                        DBusError *, error)
 
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index e9c03c1afbbc..40c1d327fb98 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -38,7 +38,7 @@ testHashInit(int size)
 
         if (virHashTableSize(hash) != oldsize) {
             VIR_TEST_DEBUG("hash grown from %zd to %zd",
-                     (size_t)oldsize, (size_t)virHashTableSize(hash));
+                     (size_t) oldsize, (size_t) virHashTableSize(hash));
         }
     }
 
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 5b03cb6aee5e..cc7fdf8be68f 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -53,7 +53,7 @@ VIR_LOG_INIT("tests.hostdevtest");
 static const char *drv_name = "test_driver";
 static const char *dom_name = "test_domain";
 static const unsigned char *uuid =
-            (unsigned char *)("f92360b0-2541-8791-fb32-d1f838811541");
+            (unsigned char *) ("f92360b0-2541-8791-fb32-d1f838811541");
 static int nhostdevs = 3;
 static virDomainHostdevDefPtr hostdevs[] = {NULL, NULL, NULL};
 static virPCIDevicePtr dev[] = {NULL, NULL, NULL};
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index ef869b16e363..3cc388bceafa 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -328,7 +328,7 @@ static int testExecRestart(const void *opaque)
                                                data->nservers,
                                                data->serverNames,
                                                testNewServerPostExecRestart,
-                                               (void *)data)))
+                                               (void *) data)))
         goto cleanup;
 
     for (i = 0; i < data->nservers; i++) {
diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
index be7d019c310a..8d63b268d031 100644
--- a/tests/virnetmessagetest.c
+++ b/tests/virnetmessagetest.c
@@ -123,13 +123,13 @@ static int testMessageHeaderDecode(const void *args ATTRIBUTE_UNUSED)
 
     if (msg->bufferOffset != 0x4) {
         VIR_DEBUG("Expecting offset %zu got %zu",
-                  (size_t)4, msg->bufferOffset);
+                  (size_t) 4, msg->bufferOffset);
         goto cleanup;
     }
 
     if (msg->bufferLength != 0x1c) {
         VIR_DEBUG("Expecting length %zu got %zu",
-                  (size_t)0x1c, msg->bufferLength);
+                  (size_t) 0x1c, msg->bufferLength);
         goto cleanup;
     }
 
@@ -346,13 +346,13 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
 
     if (msg->bufferOffset != 0x4) {
         VIR_DEBUG("Expecting offset %zu got %zu",
-                  (size_t)4, msg->bufferOffset);
+                  (size_t) 4, msg->bufferOffset);
         goto cleanup;
     }
 
     if (msg->bufferLength != 0x74) {
         VIR_DEBUG("Expecting length %zu got %zu",
-                  (size_t)0x74, msg->bufferLength);
+                  (size_t) 0x74, msg->bufferLength);
         goto cleanup;
     }
 
@@ -365,13 +365,13 @@ static int testMessagePayloadDecode(const void *args ATTRIBUTE_UNUSED)
 
     if (msg->bufferOffset != 28) {
         VIR_DEBUG("Expect message offset %zu got %zu",
-                  msg->bufferOffset, (size_t)28);
+                  msg->bufferOffset, (size_t) 28);
         goto cleanup;
     }
 
     if (msg->bufferLength != 0x74) {
         VIR_DEBUG("Expecting length %zu got %zu",
-                  (size_t)0x1c, msg->bufferLength);
+                  (size_t) 0x1c, msg->bufferLength);
         goto cleanup;
     }
 
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 9f9a24348449..638e05127834 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -81,7 +81,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
         in6.sin6_port = htons(BASE_PORT + i);
         in6.sin6_addr = in6addr_loopback;
 
-        if (bind(s4, (struct sockaddr *)&in4, sizeof(in4)) < 0) {
+        if (bind(s4, (struct sockaddr *) &in4, sizeof(in4)) < 0) {
             if (errno == EADDRINUSE) {
                 VIR_FORCE_CLOSE(s4);
                 VIR_FORCE_CLOSE(s6);
@@ -91,7 +91,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
         }
 
         if (*hasIPv6) {
-            if (bind(s6, (struct sockaddr *)&in6, sizeof(in6)) < 0) {
+            if (bind(s6, (struct sockaddr *) &in6, sizeof(in6)) < 0) {
                 if (errno == EADDRINUSE) {
                     VIR_FORCE_CLOSE(s4);
                     VIR_FORCE_CLOSE(s6);
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 86647f3014b0..9205d05724a8 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -62,7 +62,7 @@ struct testTLSContextData {
  */
 static int testTLSContextInit(const void *opaque)
 {
-    struct testTLSContextData *data = (struct testTLSContextData *)opaque;
+    struct testTLSContextData *data = (struct testTLSContextData *) opaque;
     virNetTLSContextPtr ctxt = NULL;
     int ret = -1;
 
diff --git a/tests/virnettlshelpers.c b/tests/virnettlshelpers.c
index 5c94f899774a..3f5cc7ae416a 100644
--- a/tests/virnettlshelpers.c
+++ b/tests/virnettlshelpers.c
@@ -74,7 +74,7 @@ gnutls_x509_privkey_t privkey;
 static gnutls_x509_privkey_t testTLSLoadKey(void)
 {
     gnutls_x509_privkey_t key;
-    const gnutls_datum_t data = { (unsigned char *)PRIVATE_KEY, strlen(PRIVATE_KEY) };
+    const gnutls_datum_t data = { (unsigned char *) PRIVATE_KEY, strlen(PRIVATE_KEY) };
     int err;
 
     if ((err = gnutls_x509_privkey_init(&key)) < 0) {
@@ -137,7 +137,7 @@ static void testTLSDerEncode(ASN1_TYPE src,
 
   asn1_der_coding(src, src_name, data, &size, NULL);
 
-  res->data = (unsigned char *)data;
+  res->data = (unsigned char *) data;
   res->size = size;
 }
 
diff --git a/tests/virnettlssessiontest.c b/tests/virnettlssessiontest.c
index 7e856071817d..f2501661f41e 100644
--- a/tests/virnettlssessiontest.c
+++ b/tests/virnettlssessiontest.c
@@ -80,7 +80,7 @@ static ssize_t testRead(char *buf, size_t len, void *opaque)
  */
 static int testTLSSessionInit(const void *opaque)
 {
-    struct testTLSSessionData *data = (struct testTLSSessionData *)opaque;
+    struct testTLSSessionData *data = (struct testTLSSessionData *) opaque;
     virNetTLSContextPtr clientCtxt = NULL;
     virNetTLSContextPtr serverCtxt = NULL;
     virNetTLSSessionPtr clientSess = NULL;
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 176c64d65435..773cc16840ca 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -844,7 +844,7 @@ init_env(void)
 
 # define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \
     do { \
-        struct pciDevice dev = {.id = (char *)Id, .vendor = Vendor, \
+        struct pciDevice dev = {.id = (char *) Id, .vendor = Vendor, \
                                 .device = Device, __VA_ARGS__}; \
         pci_device_new_from_stub(&dev); \
     } while (0)
diff --git a/tests/virrandommock.c b/tests/virrandommock.c
index fd1a61f67321..52211644e4c6 100644
--- a/tests/virrandommock.c
+++ b/tests/virrandommock.c
@@ -46,7 +46,7 @@ int virRandomGenerateWWN(char **wwn,
                          const char *virt_type ATTRIBUTE_UNUSED)
 {
     return virAsprintf(wwn, "5100000%09llx",
-                       (unsigned long long)virRandomBits(36));
+                       (unsigned long long) virRandomBits(36));
 }
 
 
diff --git a/tests/virrotatingfiletest.c b/tests/virrotatingfiletest.c
index 89ceda8e49bd..f1d4699e5cac 100644
--- a/tests/virrotatingfiletest.c
+++ b/tests/virrotatingfiletest.c
@@ -58,8 +58,8 @@ static int testRotatingFileWriterAssertOneFileSize(const char *filename,
             return -1;
         } else if (sb.st_size != size) {
             fprintf(stderr, "File %s should be %llu bytes not %llu\n",
-                    filename, (unsigned long long)size,
-                    (unsigned long long)sb.st_size);
+                    filename, (unsigned long long) size,
+                    (unsigned long long) sb.st_size);
             return -1;
         } else {
             return 0;
@@ -127,7 +127,7 @@ static int testRotatingFileInitOne(const char *filename,
         VIR_DEBUG("Deleting %s", filename);
         unlink(filename);
     } else {
-        VIR_DEBUG("Creating %s size %zu", filename, (size_t)size);
+        VIR_DEBUG("Creating %s size %zu", filename, (size_t) size);
         char buf[1024];
         int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0700);
         if (fd < 0) {
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 1230aba5b7a3..18558d3356b2 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -179,7 +179,7 @@ static int testAdd(const void *args)
     size_t i;
 
     for (i = 0; data->tokens[i]; i++) {
-        char **tmp = virStringListAdd((const char **)list, data->tokens[i]);
+        char **tmp = virStringListAdd((const char **) list, data->tokens[i]);
         if (!tmp)
             goto cleanup;
         virStringListFree(list);
@@ -191,7 +191,7 @@ static int testAdd(const void *args)
         VIR_ALLOC(list) < 0)
         goto cleanup;
 
-    if (!(got = virStringListJoin((const char **)list, data->delim))) {
+    if (!(got = virStringListJoin((const char **) list, data->delim))) {
         VIR_DEBUG("Got no result");
         goto cleanup;
     }
diff --git a/tests/virtypedparamtest.c b/tests/virtypedparamtest.c
index fbacfa85ad44..cd79bbe63736 100644
--- a/tests/virtypedparamtest.c
+++ b/tests/virtypedparamtest.c
@@ -48,7 +48,7 @@ static int
 testTypedParamsValidate(const void *opaque)
 {
     int rv;
-    TypedParameterTest *test = (TypedParameterTest *)opaque;
+    TypedParameterTest *test = (TypedParameterTest *) opaque;
     virErrorPtr errptr;
 
     rv = virTypedParamsValidate(
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index f6bcd7b01282..90110b2d24bd 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -167,7 +167,7 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
         directoryAndFileName = strtok_r(NULL, "", &saveptr);
 
         if (directoryAndFileName == NULL) {
-            directoryAndFileName = (char *)"";
+            directoryAndFileName = (char *) "";
         } else {
             directoryAndFileName += strspn(directoryAndFileName, " ");
         }
-- 
2.17.0




More information about the libvir-list mailing list