[libvirt] [PATCH 21/31] tests/: Remove the whitespace before ";"

Osier Yang jyang at redhat.com
Tue May 21 10:00:51 UTC 2013


---
 tests/commandhelper.c            |  6 +++---
 tests/eventtest.c                | 18 +++++++++---------
 tests/fdstreamtest.c             | 14 +++++++-------
 tests/libvirtdconftest.c         |  2 +-
 tests/nodeinfotest.c             |  2 +-
 tests/qemuhelptest.c             |  2 +-
 tests/qemumonitortestutils.c     |  2 +-
 tests/qemuxml2argvtest.c         |  4 ++--
 tests/securityselinuxlabeltest.c | 12 ++++++------
 tests/ssh.c                      |  4 ++--
 tests/testutils.c                | 16 ++++++++--------
 tests/vircgrouptest.c            |  2 +-
 tests/virnetsockettest.c         | 10 +++++-----
 tests/viruritest.c               |  2 +-
 14 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index d0b9718..e4cc5d2 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -65,7 +65,7 @@ int main(int argc, char **argv) {
     if (!log)
         goto error;
 
-    for (i = 1 ; i < argc ; i++) {
+    for (i = 1; i < argc; i++) {
         fprintf(log, "ARG:%s\n", argv[i]);
     }
 
@@ -88,14 +88,14 @@ int main(int argc, char **argv) {
     }
     qsort(newenv, n, sizeof(newenv[0]), envsort);
 
-    for (i = 0 ; i < n ; i++) {
+    for (i = 0; i < n; i++) {
         /* Ignore the variables used to instruct the loader into
          * behaving differently, as they could throw the tests off. */
         if (!STRPREFIX(newenv[i], "LD_"))
             fprintf(log, "ENV:%s\n", newenv[i]);
     }
 
-    for (i = 0 ; i < sysconf(_SC_OPEN_MAX) ; i++) {
+    for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) {
         int f;
         int closed;
         if (i == fileno(log))
diff --git a/tests/eventtest.c b/tests/eventtest.c
index 700ea08..97d805a 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -144,7 +144,7 @@ verifyFired(const char *name, int handle, int timer)
     int handleFired = 0;
     int timerFired = 0;
     int i;
-    for (i = 0 ; i < NUM_FDS ; i++) {
+    for (i = 0; i < NUM_FDS; i++) {
         if (handles[i].fired) {
             if (i != handle) {
                 virtTestResult(name, 1,
@@ -177,7 +177,7 @@ verifyFired(const char *name, int handle, int timer)
     }
 
 
-    for (i = 0 ; i < NUM_TIME ; i++) {
+    for (i = 0; i < NUM_TIME; i++) {
         if (timers[i].fired) {
             if (i != timer) {
                 virtTestResult(name, 1,
@@ -248,11 +248,11 @@ static void
 resetAll(void)
 {
     int i;
-    for (i = 0 ; i < NUM_FDS ; i++) {
+    for (i = 0; i < NUM_FDS; i++) {
         handles[i].fired = 0;
         handles[i].error = EV_ERROR_NONE;
     }
-    for (i = 0 ; i < NUM_TIME ; i++) {
+    for (i = 0; i < NUM_TIME; i++) {
         timers[i].fired = 0;
         timers[i].error = EV_ERROR_NONE;
     }
@@ -265,7 +265,7 @@ mymain(void)
     pthread_t eventThread;
     char one = '1';
 
-    for (i = 0 ; i < NUM_FDS ; i++) {
+    for (i = 0; i < NUM_FDS; i++) {
         if (pipe(handles[i].pipeFD) < 0) {
             fprintf(stderr, "Cannot create pipe: %d", errno);
             return EXIT_FAILURE;
@@ -282,7 +282,7 @@ mymain(void)
 
     virEventPollInit();
 
-    for (i = 0 ; i < NUM_FDS ; i++) {
+    for (i = 0; i < NUM_FDS; i++) {
         handles[i].delete = -1;
         handles[i].watch =
             virEventPollAddHandle(handles[i].pipeFD[0],
@@ -291,7 +291,7 @@ mymain(void)
                                   &handles[i], NULL);
     }
 
-    for (i = 0 ; i < NUM_TIME ; i++) {
+    for (i = 0; i < NUM_TIME; i++) {
         timers[i].delete = -1;
         timers[i].timeout = -1;
         timers[i].timer =
@@ -432,9 +432,9 @@ mymain(void)
     if (finishJob("Deleted during dispatch", -1, 2) != EXIT_SUCCESS)
         return EXIT_FAILURE;
 
-    for (i = 0 ; i < NUM_FDS - 1 ; i++)
+    for (i = 0; i < NUM_FDS - 1; i++)
         virEventPollRemoveHandle(handles[i].watch);
-    for (i = 0 ; i < NUM_TIME - 1 ; i++)
+    for (i = 0; i < NUM_TIME - 1; i++)
         virEventPollRemoveTimeout(timers[i].timer);
 
     resetAll();
diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c
index 9f780c9..a5aed14 100644
--- a/tests/fdstreamtest.c
+++ b/tests/fdstreamtest.c
@@ -60,7 +60,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
         VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < PATTERN_LEN ; i++)
+    for (i = 0; i < PATTERN_LEN; i++)
         pattern[i] = i;
 
     if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
@@ -69,7 +69,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
     if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < 10 ; i++) {
+    for (i = 0; i < 10; i++) {
         if (safewrite(fd, pattern, PATTERN_LEN) != PATTERN_LEN)
             goto cleanup;
     }
@@ -88,7 +88,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
                             O_RDONLY) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < 10 ; i++) {
+    for (i = 0; i < 10; i++) {
         size_t offset = 0;
         size_t want;
         if (i == 0)
@@ -192,7 +192,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
         VIR_ALLOC_N(buf, PATTERN_LEN) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < PATTERN_LEN ; i++)
+    for (i = 0; i < PATTERN_LEN; i++)
         pattern[i] = i;
 
     if (virAsprintf(&file, "%s/input.data", scratchdir) < 0)
@@ -209,7 +209,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
                               O_WRONLY, 0600) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < 10 ; i++) {
+    for (i = 0; i < 10; i++) {
         size_t offset = 0;
         size_t want;
         if (i == 0)
@@ -247,7 +247,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
     if ((fd = open(file, O_RDONLY)) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < 10 ; i++) {
+    for (i = 0; i < 10; i++) {
         size_t want;
         if (i == 9)
             want = PATTERN_LEN / 2;
@@ -261,7 +261,7 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
 
         if (i == 0) {
             size_t j;
-            for (j = 0 ; j < (PATTERN_LEN / 2) ; j++) {
+            for (j = 0; j < (PATTERN_LEN / 2); j++) {
                 if (buf[j] != 0) {
                     fprintf(stderr, "Mismatched pattern data iteration %zu\n", i);
                     goto cleanup;
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c
index e1dd82d..d45c31a 100644
--- a/tests/libvirtdconftest.c
+++ b/tests/libvirtdconftest.c
@@ -223,7 +223,7 @@ mymain(void)
         goto cleanup;
     }
     VIR_DEBUG("Initial config [%s]", filedata);
-    for (i = 0 ; params[i] != 0 ; i++) {
+    for (i = 0; params[i] != 0; i++) {
         const struct testCorruptData data = { params, filedata, filename, i };
         if (virtTestRun("Test corruption", 1, testCorrupt, &data) < 0)
             ret = -1;
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 733d350..bce56f3 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -139,7 +139,7 @@ mymain(void)
     if (virInitialize() < 0)
         return EXIT_FAILURE;
 
-    for (i = 0 ; i < ARRAY_CARDINALITY(nodeData); i++)
+    for (i = 0; i < ARRAY_CARDINALITY(nodeData); i++)
       if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0)
         ret = -1;
 
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index f7f88d0..43e6dce 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -24,7 +24,7 @@ static void printMismatchedFlags(virQEMUCapsPtr got,
 {
     int i;
 
-    for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
+    for (i = 0; i < QEMU_CAPS_LAST; i++) {
         bool gotFlag = virQEMUCapsGet(got, i);
         bool expectFlag = virQEMUCapsGet(expect, i);
         if (gotFlag && !expectFlag)
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 87f35d6..1a4bb88 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -381,7 +381,7 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test)
     VIR_FREE(test->incoming);
     VIR_FREE(test->outgoing);
 
-    for (i = 0 ; i < test->nitems ; i++)
+    for (i = 0; i < test->nitems; i++)
         qemuMonitorTestItemFree(test->items[i]);
     VIR_FREE(test->items);
 
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fb61017..299eafd 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -263,13 +263,13 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
     };
     size_t i;
 
-    for (i = 0 ; i < ARRAY_CARDINALITY(newModels) ; i++) {
+    for (i = 0; i < ARRAY_CARDINALITY(newModels); i++) {
         if (virQEMUCapsAddCPUDefinition(caps, newModels[i]) < 0)
             return -1;
     }
     if (skipLegacy)
         return 0;
-    for (i = 0 ; i < ARRAY_CARDINALITY(legacyModels) ; i++) {
+    for (i = 0; i < ARRAY_CARDINALITY(legacyModels); i++) {
         if (virQEMUCapsAddCPUDefinition(caps, legacyModels[i]) < 0)
             return -1;
     }
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 275ca93..5ae4f57 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -169,7 +169,7 @@ testSELinuxLoadDef(const char *testname)
                                         0)))
         goto cleanup;
 
-    for (i = 0 ; i < def->ndisks ; i++) {
+    for (i = 0; i < def->ndisks; i++) {
         if (def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_FILE &&
             def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK)
             continue;
@@ -178,7 +178,7 @@ testSELinuxLoadDef(const char *testname)
             goto cleanup;
     }
 
-    for (i = 0 ; i < def->nserials ; i++) {
+    for (i = 0; i < def->nserials; i++) {
         if (def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_FILE &&
             def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_PIPE &&
             def->serials[i]->source.type != VIR_DOMAIN_CHR_TYPE_DEV &&
@@ -216,7 +216,7 @@ testSELinuxCreateDisks(testSELinuxFile *files, size_t nfiles)
     if (virFileMakePath(abs_builddir "/securityselinuxlabeldata") < 0)
         return -1;
 
-    for (i = 0 ; i < nfiles ; i++) {
+    for (i = 0; i < nfiles; i++) {
         if (virFileTouch(files[i].file, 0600) < 0)
             return -1;
     }
@@ -228,7 +228,7 @@ testSELinuxDeleteDisks(testSELinuxFile *files, size_t nfiles)
 {
     size_t i;
 
-    for (i = 0 ; i < nfiles ; i++) {
+    for (i = 0; i < nfiles; i++) {
         if (unlink(files[i].file) < 0)
             return -1;
     }
@@ -241,7 +241,7 @@ testSELinuxCheckLabels(testSELinuxFile *files, size_t nfiles)
     size_t i;
     security_context_t ctx;
 
-    for (i = 0 ; i < nfiles ; i++) {
+    for (i = 0; i < nfiles; i++) {
         if (getfilecon(files[i].file, &ctx) < 0) {
             if (errno == ENODATA) {
                 ctx = NULL;
@@ -294,7 +294,7 @@ cleanup:
         goto cleanup;
 
     virDomainDefFree(def);
-    for (i = 0 ; i < nfiles; i++) {
+    for (i = 0; i < nfiles; i++) {
         VIR_FREE(files[i].file);
         VIR_FREE(files[i].context);
     }
diff --git a/tests/ssh.c b/tests/ssh.c
index a688c28..48009a4 100644
--- a/tests/ssh.c
+++ b/tests/ssh.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
     int failConnect = 0; /* Exit -1, with no data on stdout, msg on stderr */
     int dieEarly = 0;    /* Exit -1, with partial data on stdout, msg on stderr */
 
-    for (i = 1 ; i < argc ; i++) {
+    for (i = 1; i < argc; i++) {
         if (STREQ(argv[i], "nosuchhost"))
             failConnect = 1;
         else if (STREQ(argv[i], "crashinghost"))
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
         return -1;
     }
 
-    for (i = 1 ; i < argc ; i++)
+    for (i = 1; i < argc; i++)
         printf("%s%c", argv[i], i == (argc -1) ? '\n' : ' ');
 
     return 0;
diff --git a/tests/testutils.c b/tests/testutils.c
index 222c016..528e432 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -420,7 +420,7 @@ int virtTestDifferenceBin(FILE *stream,
 
     if (virTestGetDebug() < 2) {
         /* Skip to first character where they differ */
-        for (i = 0 ; i < length ; i++) {
+        for (i = 0; i < length; i++) {
             if (expect[i] != actual[i]) {
                 start = i;
                 break;
@@ -428,7 +428,7 @@ int virtTestDifferenceBin(FILE *stream,
         }
 
         /* Work backwards to last character where they differ */
-        for (i = (length -1) ; i >= 0 ; i--) {
+        for (i = (length -1); i >= 0; i--) {
             if (expect[i] != actual[i]) {
                 end = i;
                 break;
@@ -443,14 +443,14 @@ int virtTestDifferenceBin(FILE *stream,
 
     /* Show the trimmed differences */
     fprintf(stream, "\nExpect [ Region %d-%d", (int)start, (int)end);
-    for (i = start; i < end ; i++) {
+    for (i = start; i < end; i++) {
         if ((i % 4) == 0)
             fprintf(stream, "\n    ");
         fprintf(stream, "0x%02x, ", ((int)expect[i])&0xff);
     }
     fprintf(stream, "]\n");
     fprintf(stream, "Actual [ Region %d-%d", (int)start, (int)end);
-    for (i = start; i < end ; i++) {
+    for (i = start; i < end; i++) {
         if ((i % 4) == 0)
             fprintf(stream, "\n    ");
         fprintf(stream, "0x%02x, ", ((int)actual[i])&0xff);
@@ -530,7 +530,7 @@ virtTestErrorHook(int n, void *data ATTRIBUTE_UNUSED)
     symbols = backtrace_symbols(trace, ntrace);
     if (symbols) {
         fprintf(stderr, "Failing allocation %d at:\n", n);
-        for (i = 0 ; i < ntrace ; i++) {
+        for (i = 0; i < ntrace; i++) {
             if (symbols[i])
                 fprintf(stderr, "  TRACE:  %s\n", symbols[i]);
         }
@@ -666,7 +666,7 @@ int virtTestMain(int argc,
 
         if (mp) {
             int i;
-            for (i = 0 ; i < mp ; i++) {
+            for (i = 0; i < mp; i++) {
                 workers[i] = fork();
                 if (workers[i] == 0) {
                     worker = i + 1;
@@ -677,7 +677,7 @@ int virtTestMain(int argc,
 
         /* Run once for each alloc, failing a different one
            and validating that the test case failed */
-        for (n = 0; n < approxAlloc && (!mp || worker) ; n++) {
+        for (n = 0; n < approxAlloc && (!mp || worker); n++) {
             if (mp &&
                 (n % mp) != (worker - 1))
                 continue;
@@ -701,7 +701,7 @@ int virtTestMain(int argc,
                 _exit(ret);
             } else {
                 int i;
-                for (i = 0 ; i < mp ; i++) {
+                for (i = 0; i < mp; i++) {
                     if (virProcessWait(workers[i], NULL) < 0)
                         ret = EXIT_FAILURE;
                 }
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index 75acfcb..b00a187 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -49,7 +49,7 @@ static int validateCgroup(virCgroupPtr cgroup,
         return -1;
     }
 
-    for (i = 0 ; i < VIR_CGROUP_CONTROLLER_LAST ; i++) {
+    for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
         if (STRNEQ_NULLABLE(expectMountPoint[i],
                             cgroup->controllers[i].mountPoint)) {
             fprintf(stderr, "Wrong mount '%s', expected '%s' for '%s'\n",
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 5e2925d..4c5a0ea 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -86,7 +86,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
 
     freeifaddrs(ifaddr);
 
-    for (i = 0 ; i < 50 ; i++) {
+    for (i = 0; i < 50; i++) {
         int only = 1;
         if ((s4 = socket(AF_INET, SOCK_STREAM, 0)) < 0)
             goto cleanup;
@@ -165,7 +165,7 @@ static int testSocketTCPAccept(const void *opaque)
     if (virNetSocketNewListenTCP(data->lnode, portstr, &lsock, &nlsock) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < nlsock ; i++) {
+    for (i = 0; i < nlsock; i++) {
         if (virNetSocketListen(lsock[i], 0) < 0)
             goto cleanup;
     }
@@ -175,7 +175,7 @@ static int testSocketTCPAccept(const void *opaque)
 
     virObjectUnref(csock);
 
-    for (i = 0 ; i < nlsock ; i++) {
+    for (i = 0; i < nlsock; i++) {
         if (virNetSocketAccept(lsock[i], &ssock) != -1 && ssock) {
             char c = 'a';
             if (virNetSocketWrite(ssock, &c, 1) != -1 &&
@@ -192,7 +192,7 @@ static int testSocketTCPAccept(const void *opaque)
 
 cleanup:
     virObjectUnref(ssock);
-    for (i = 0 ; i < nlsock ; i++)
+    for (i = 0; i < nlsock; i++)
         virObjectUnref(lsock[i]);
     VIR_FREE(lsock);
     return ret;
@@ -346,7 +346,7 @@ static int testSocketCommandNormal(const void *data ATTRIBUTE_UNUSED)
     if (virNetSocketRead(csock, buf, sizeof(buf)) < 0)
         goto cleanup;
 
-    for (i = 0 ; i < sizeof(buf) ; i++)
+    for (i = 0; i < sizeof(buf); i++)
         if (buf[i] != '\0')
             goto cleanup;
 
diff --git a/tests/viruritest.c b/tests/viruritest.c
index 6339d17..dab8129 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -92,7 +92,7 @@ static int testURIParse(const void *args)
         goto cleanup;
     }
 
-    for (i = 0 ; data->params && data->params[i].name && i < uri->paramsCount ; i++) {
+    for (i = 0; data->params && data->params[i].name && i < uri->paramsCount; i++) {
         if (!STREQ_NULLABLE(data->params[i].name, uri->params[i].name)) {
             VIR_DEBUG("Expected param name %zu '%s', actual '%s'",
                       i, data->params[i].name, uri->params[i].name);
-- 
1.8.1.4




More information about the libvir-list mailing list