[libvirt] [PATCH 14/15] Remove unneeded curly brackets around oneline code blocks in tests/

Martin Kletzander mkletzan at redhat.com
Thu Nov 6 16:38:39 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>
---
 tests/commandhelper.c            |  3 +--
 tests/esxutilstest.c             | 18 ++++++-----------
 tests/eventtest.c                |  3 +--
 tests/networkxml2conftest.c      |  3 +--
 tests/networkxml2xmltest.c       |  3 +--
 tests/networkxml2xmlupdatetest.c |  3 +--
 tests/nodeinfotest.c             |  3 +--
 tests/nwfilterxml2xmltest.c      |  3 +--
 tests/openvzutilstest.c          |  9 +++------
 tests/qemuxml2argvtest.c         |  6 ++----
 tests/qemuxmlnstest.c            |  3 +--
 tests/secretxml2xmltest.c        |  3 +--
 tests/securityselinuxlabeltest.c |  6 ++----
 tests/sexpr2xmltest.c            |  3 +--
 tests/shunloadtest.c             |  6 ++----
 tests/storagepoolxml2xmltest.c   |  3 +--
 tests/storagevolxml2argvtest.c   |  3 +--
 tests/storagevolxml2xmltest.c    |  3 +--
 tests/sysinfotest.c              |  6 ++----
 tests/utiltest.c                 |  3 +--
 tests/virbuftest.c               |  3 +--
 tests/virhashtest.c              | 42 ++++++++++++++--------------------------
 tests/virtimetest.c              |  3 +--
 tests/vmx2xmltest.c              | 24 ++++++++---------------
 tests/xml2sexprtest.c            |  3 +--
 tests/xml2vmxtest.c              | 39 +++++++++++++------------------------
 26 files changed, 69 insertions(+), 138 deletions(-)

diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 86ed891..015efda 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -70,9 +70,8 @@ int main(int argc, char **argv) {
     if (!log)
         goto cleanup;

-    for (i = 1; i < argc; i++) {
+    for (i = 1; i < argc; i++)
         fprintf(log, "ARG:%s\n", argv[i]);
-    }

     origenv = environ;
     n = 0;
diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c
index 41c0807..1061487 100644
--- a/tests/esxutilstest.c
+++ b/tests/esxutilstest.c
@@ -50,13 +50,11 @@ testParseDatastorePath(const void *data ATTRIBUTE_UNUSED)

         if (esxUtil_ParseDatastorePath
              (paths[i].datastorePath, &datastoreName, &directoryName,
-              &directoryAndFileName) != paths[i].result) {
+              &directoryAndFileName) != paths[i].result)
             goto failure;
-        }

-        if (paths[i].result < 0) {
+        if (paths[i].result < 0)
             continue;
-        }

         if (STRNEQ(paths[i].datastoreName, datastoreName)) {
             virtTestDifference(stderr, paths[i].datastoreName, datastoreName);
@@ -134,13 +132,11 @@ testConvertDateTimeToCalendarTime(const void *data ATTRIBUTE_UNUSED)
         dateTime.value = (char *)times[i].dateTime;

         if (esxVI_DateTime_ConvertToCalendarTime(&dateTime,
-                                                 &calendarTime) < 0) {
+                                                 &calendarTime) < 0)
             return -1;
-        }

-        if (times[i].calendarTime != calendarTime) {
+        if (times[i].calendarTime != calendarTime)
             return -1;
-        }
     }

     return 0;
@@ -186,9 +182,8 @@ testEscapeDatastoreItem(const void *data ATTRIBUTE_UNUSED)

         escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string);

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

         if (STRNEQ(datastoreItems[i].escaped, escaped)) {
             VIR_FREE(escaped);
@@ -228,9 +223,8 @@ testConvertWindows1252ToUTF8(const void *data ATTRIBUTE_UNUSED)
         utf8 = virVMXConvertToUTF8("Windows-1252",
                                    windows1252ToUTF8[i].windows1252);

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

         if (STRNEQ(windows1252ToUTF8[i].utf8, utf8)) {
             VIR_FREE(utf8);
diff --git a/tests/eventtest.c b/tests/eventtest.c
index 87b49d3..13adbf6 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -124,9 +124,8 @@ static int eventThreadJobDone;
 ATTRIBUTE_NORETURN static void *eventThreadLoop(void *data ATTRIBUTE_UNUSED) {
     while (1) {
         pthread_mutex_lock(&eventThreadMutex);
-        while (!eventThreadRunOnce) {
+        while (!eventThreadRunOnce)
             pthread_cond_wait(&eventThreadRunCond, &eventThreadMutex);
-        }
         eventThreadRunOnce = 0;
         pthread_mutex_unlock(&eventThreadMutex);

diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 4f1d934..fc37e14 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -87,9 +87,8 @@ testCompareXMLToConfHelper(const void *data)
     if (virAsprintf(&inxml, "%s/networkxml2confdata/%s.xml",
                     abs_srcdir, info->name) < 0 ||
         virAsprintf(&outxml, "%s/networkxml2confdata/%s.conf",
-                    abs_srcdir, info->name) < 0) {
+                    abs_srcdir, info->name) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToConfFiles(inxml, outxml, info->caps);

diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 65ac591..ac3c12d 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -68,9 +68,8 @@ testCompareXMLToXMLHelper(const void *data)
     if (virAsprintf(&inxml, "%s/networkxml2xmlin/%s.xml",
                     abs_srcdir, info->name) < 0 ||
         virAsprintf(&outxml, "%s/networkxml2xmlout/%s.xml",
-                    abs_srcdir, info->name) < 0) {
+                    abs_srcdir, info->name) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(inxml, outxml, info->flags);

diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index f34638a..fa1d597 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -101,9 +101,8 @@ testCompareXMLToXMLHelper(const void *data)
         virAsprintf(&updatexml, "%s/networkxml2xmlupdatein/%s.xml",
                     abs_srcdir, info->updatexml) < 0 ||
         virAsprintf(&outxml, "%s/networkxml2xmlupdateout/%s.xml",
-                    abs_srcdir, info->outxml) < 0) {
+                    abs_srcdir, info->outxml) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(netxml, updatexml, outxml, info->flags,
                                       info->command, info->section,
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 3c76e5d..beefc3a 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -187,9 +187,8 @@ linuxTestNodeInfo(const void *opaque)
         virAsprintf(&cpuinfo, "%s/nodeinfodata/linux-%s-%s.cpuinfo",
                     abs_srcdir, archStr, data->testName) < 0 ||
         virAsprintf(&output, "%s/nodeinfodata/linux-%s-%s.expected",
-                    abs_srcdir, archStr, data->testName) < 0) {
+                    abs_srcdir, archStr, data->testName) < 0)
         goto cleanup;
-    }

     result = linuxTestCompareFiles(cpuinfo, sysfs_dir, data->arch, output);

diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index ba1ead1..84155d7 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -79,9 +79,8 @@ testCompareXMLToXMLHelper(const void *data)
     if (virAsprintf(&inxml, "%s/nwfilterxml2xmlin/%s.xml",
                     abs_srcdir, tp->name) < 0 ||
         virAsprintf(&outxml, "%s/nwfilterxml2xmlout/%s.xml",
-                    abs_srcdir, tp->name) < 0) {
+                    abs_srcdir, tp->name) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(inxml, outxml, tp->expect_warning);

diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index ed2c098..15315a3 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -42,19 +42,16 @@ testReadConfigParam(const void *data ATTRIBUTE_UNUSED)
     char *conf = NULL;
     char *value = NULL;

-    if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0) {
+    if (virAsprintf(&conf, "%s/openvzutilstest.conf", abs_srcdir) < 0)
         return -1;
-    }

     for (i = 0; i < ARRAY_CARDINALITY(configParams); ++i) {
         if (openvzReadConfigParam(conf, configParams[i].param,
-                                  &value) != configParams[i].ret) {
+                                  &value) != configParams[i].ret)
             goto cleanup;
-        }

-        if (configParams[i].ret != 1) {
+        if (configParams[i].ret != 1)
             continue;
-        }

         if (STRNEQ(configParams[i].value, value)) {
             virtTestDifference(stderr, configParams[i].value, value);
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 63e61bd..1e66b26 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -335,9 +335,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     virResetLastError();

     if (vmdef->os.arch == VIR_ARCH_X86_64 ||
-        vmdef->os.arch == VIR_ARCH_I686) {
+        vmdef->os.arch == VIR_ARCH_I686)
         virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
-    }

     if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
         goto out;
@@ -347,9 +346,8 @@ static int testCompareXMLToArgvFiles(const char *xml,

         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
-            hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
+            hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
             hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
-        }
     }

     for (i = 0; i < vmdef->ndisks; i++) {
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 2f37a26..a53d081 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -108,9 +108,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     virResetLastError();

     if (vmdef->os.arch == VIR_ARCH_X86_64 ||
-        vmdef->os.arch == VIR_ARCH_I686) {
+        vmdef->os.arch == VIR_ARCH_I686)
         virQEMUCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
-    }

     if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
         goto fail;
diff --git a/tests/secretxml2xmltest.c b/tests/secretxml2xmltest.c
index c9d879e..769e886 100644
--- a/tests/secretxml2xmltest.c
+++ b/tests/secretxml2xmltest.c
@@ -61,9 +61,8 @@ testCompareXMLToXMLHelper(const void *data)
         virAsprintf(&outxml, "%s/secretxml2xml%s/%s.xml",
                     abs_srcdir,
                     info->different ? "out" : "in",
-                    info->name) < 0) {
+                    info->name) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(inxml, outxml);

diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 455eb74..8106c77 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -120,9 +120,8 @@ testSELinuxLoadFileList(const char *testname,
                     abs_srcdir, testname) < 0)
         goto cleanup;

-    if (!(fp = fopen(path, "r"))) {
+    if (!(fp = fopen(path, "r")))
         goto cleanup;
-    }

     if (VIR_ALLOC_N(line, 1024) < 0)
         goto cleanup;
@@ -191,9 +190,8 @@ testSELinuxLoadDef(const char *testname)
                     abs_srcdir, testname) < 0)
         goto cleanup;

-    if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0) {
+    if (virFileReadAll(xmlfile, 1024*1024, &xmlstr) < 0)
         goto cleanup;
-    }

     if (!(def = virDomainDefParseString(xmlstr, caps, xmlopt,
                                         QEMU_EXPECTED_VIRT_TYPES,
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index 7247414..4ed1d4d 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -102,9 +102,8 @@ testCompareHelper(const void *data)
     if (virAsprintf(&xml, "%s/sexpr2xmldata/sexpr2xml-%s.xml",
                     abs_srcdir, info->input) < 0 ||
         virAsprintf(&args, "%s/sexpr2xmldata/sexpr2xml-%s.sexpr",
-                    abs_srcdir, info->output) < 0) {
+                    abs_srcdir, info->output) < 0)
         goto cleanup;
-    }

     result = testCompareFiles(xml, args, info->version);

diff --git a/tests/shunloadtest.c b/tests/shunloadtest.c
index 80f5351..37d990d 100644
--- a/tests/shunloadtest.c
+++ b/tests/shunloadtest.c
@@ -74,9 +74,8 @@ static void *threadMain(void *arg)
         pthread_cond_signal(&cond);
     }

-    while (!quit) {
+    while (!quit)
         pthread_cond_wait(&cond, &lock);
-    }
     pthread_mutex_unlock(&lock);

     return NULL;
@@ -126,9 +125,8 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv)

     /* Wait for the thread to start and call libvirt */
     pthread_mutex_lock(&lock);
-    while (!running && !failstart) {
+    while (!running && !failstart)
         pthread_cond_wait(&cond, &lock);
-    }

     /* Close the shared library (and thus make libvirt.so
      * non-resident */
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index 8a2c0b5..d3fc0fe 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -61,9 +61,8 @@ testCompareXMLToXMLHelper(const void *data)
     if (virAsprintf(&inxml, "%s/storagepoolxml2xmlin/%s.xml",
                     abs_srcdir, (const char*)data) < 0 ||
         virAsprintf(&outxml, "%s/storagepoolxml2xmlout/%s.xml",
-                    abs_srcdir, (const char*)data) < 0) {
+                    abs_srcdir, (const char*)data) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(inxml, outxml);

diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index f9d2d2d..b3daee6 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -169,9 +169,8 @@ testCompareXMLToArgvHelper(const void *data)
     if (virAsprintf(&poolxml, "%s/storagepoolxml2xmlin/%s.xml",
                     abs_srcdir, info->pool) < 0 ||
         virAsprintf(&volxml, "%s/storagevolxml2xmlin/%s.xml",
-                    abs_srcdir, info->vol) < 0) {
+                    abs_srcdir, info->vol) < 0)
         goto cleanup;
-    }
     if (virAsprintf(&cmdline, "%s/storagevolxml2argvdata/%s.argv",
                     abs_srcdir, info->cmdline) < 0 && !info->shouldFail)
         goto cleanup;
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index 234a2f1..848f80b 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -80,9 +80,8 @@ testCompareXMLToXMLHelper(const void *data)
         virAsprintf(&inxml, "%s/storagevolxml2xmlin/%s.xml",
                     abs_srcdir, info->name) < 0 ||
         virAsprintf(&outxml, "%s/storagevolxml2xmlout/%s.xml",
-                    abs_srcdir, info->name) < 0) {
+                    abs_srcdir, info->name) < 0)
         goto cleanup;
-    }

     result = testCompareXMLToXMLFiles(poolxml, inxml, outxml);

diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index 5ba3298..a33f0dd 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -72,9 +72,8 @@ testSysinfo(const void *data)

     if (!testdata->expected ||
         virtTestLoadFile(testdata->expected, &sysfsExpectData) < 0 ||
-        !(ret = virSysinfoRead())) {
+        !(ret = virSysinfoRead()))
         goto cleanup;
-    }

     if (virSysinfoFormat(&buf, ret) < 0)
         goto cleanup;
@@ -114,9 +113,8 @@ sysinfotest_run(const char *test,
         (cpuinfo &&
          virAsprintf(&testdata.cpuinfo, "%s/%s", abs_srcdir, cpuinfo) < 0) ||
         (expected &&
-         virAsprintf(&testdata.expected, "%s/%s", abs_srcdir, expected) < 0)) {
+         virAsprintf(&testdata.expected, "%s/%s", abs_srcdir, expected) < 0))
         goto error;
-    }

     if (virtTestRun(test, testSysinfo, &testdata) < 0)
         goto error;
diff --git a/tests/utiltest.c b/tests/utiltest.c
index 89e82aa..8950cf2 100644
--- a/tests/utiltest.c
+++ b/tests/utiltest.c
@@ -124,9 +124,8 @@ testParseVersionString(const void *data ATTRIBUTE_UNUSED)
             return -1;
         }

-        if (result < 0) {
+        if (result < 0)
             continue;
-        }

         if (version != versions[i].version) {
             if (virTestGetDebug() > 0) {
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 2398890..554a8c0 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -38,9 +38,8 @@ static int testBufInfiniteLoop(const void *data)
      * which was the case after the above addchar at the time of the bug.
      * This test is a bit fragile, since it relies on virBuffer internals.
      */
-    if (virAsprintf(&addstr, "%*s", buf->a - buf->b - 1, "a") < 0) {
+    if (virAsprintf(&addstr, "%*s", buf->a - buf->b - 1, "a") < 0)
         goto out;
-    }

     if (info->doEscape)
         virBufferEscapeString(buf, "%s", addstr);
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index 340dc84..6373eb4 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -344,24 +344,20 @@ testHashForEachIter(void *payload ATTRIBUTE_UNUSED,
     virHashTablePtr hash = data;

     if (virHashAddEntry(hash, uuids_new[0], NULL) == 0 &&
-        virTestGetVerbose()) {
+        virTestGetVerbose())
         fprintf(stderr, "\nadding entries in ForEach should be forbidden");
-    }

     if (virHashUpdateEntry(hash, uuids_new[0], NULL) == 0 &&
-        virTestGetVerbose()) {
+        virTestGetVerbose())
         fprintf(stderr, "\nupdating entries in ForEach should be forbidden");
-    }

     if (virHashSteal(hash, uuids_new[0]) != NULL &&
-        virTestGetVerbose()) {
+        virTestGetVerbose())
         fprintf(stderr, "\nstealing entries in ForEach should be forbidden");
-    }

     if (virHashSteal(hash, uuids_new[0]) != NULL &&
-        virTestGetVerbose()) {
+        virTestGetVerbose())
         fprintf(stderr, "\nstealing entries in ForEach should be forbidden");
-    }

     if (virHashForEach(hash, testHashIter, NULL) >= 0 &&
         virTestGetVerbose()) {
@@ -531,17 +527,15 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED)
         virHashAddEntry(hash, keya, value3) < 0 ||
         virHashAddEntry(hash, keyc, value1) < 0 ||
         virHashAddEntry(hash, keyb, value2) < 0) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to create hash");
-        }
         goto cleanup;
     }

     if (!(array = virHashGetItems(hash, NULL)) ||
         array[3].key || array[3].value) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to get items with NULL sort");
-        }
         goto cleanup;
     }
     VIR_FREE(array);
@@ -554,9 +548,8 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED)
         STRNEQ(array[2].key, "c") ||
         STRNEQ(array[2].value, "1") ||
         array[3].key || array[3].value) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to get items with key sort");
-        }
         goto cleanup;
     }
     VIR_FREE(array);
@@ -569,9 +562,8 @@ testHashGetItems(const void *data ATTRIBUTE_UNUSED)
         STRNEQ(array[2].key, "a") ||
         STRNEQ(array[2].value, "3") ||
         array[3].key || array[3].value) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to get items with value sort");
-        }
         goto cleanup;
     }

@@ -612,44 +604,38 @@ testHashEqual(const void *data ATTRIBUTE_UNUSED)
         virHashAddEntry(hash1, keyc, value3_l) < 0 ||
         virHashAddEntry(hash2, keya, value1_u) < 0 ||
         virHashAddEntry(hash2, keyb, value2_u) < 0) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to create hashes");
-        }
         goto cleanup;
     }

     if (virHashEqual(hash1, hash2, testHashEqualCompValue)) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed equal test for different number of elements");
-        }
         goto cleanup;
     }

     if (virHashAddEntry(hash2, keyc, value4_u) < 0) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to add element to hash2");
-        }
         goto cleanup;
     }

     if (virHashEqual(hash1, hash2, testHashEqualCompValue)) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed equal test for same number of elements");
-        }
         goto cleanup;
     }

     if (virHashUpdateEntry(hash2, keyc, value3_u) < 0) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed to update element in hash2");
-        }
         goto cleanup;
     }

     if (!virHashEqual(hash1, hash2, testHashEqualCompValue)) {
-        if (virTestGetVerbose()) {
+        if (virTestGetVerbose())
             testError("\nfailed equal test for equal hash tables");
-        }
         goto cleanup;
     }

diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index 64bf19b..9ab38ae 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -88,9 +88,8 @@ testTimeLocalOffset(const void *args)
     }
     tzset();

-    if (virTimeLocalOffsetFromUTC(&actual) < 0) {
+    if (virTimeLocalOffsetFromUTC(&actual) < 0)
         return -1;
-    }

     if (data->offset != actual) {
         VIR_DEBUG("Expect Offset %ld got %ld\n",
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 5c103dd..375bc27 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -27,9 +27,8 @@ testCapsInit(void)

     caps = virCapabilitiesNew(VIR_ARCH_I686, true, true);

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

     virCapabilitiesAddHostMigrateTransport(caps, "esx");

@@ -39,14 +38,12 @@ testCapsInit(void)
                               VIR_ARCH_I686,
                               NULL, NULL, 0, NULL);

-    if (guest == NULL) {
+    if (guest == NULL)
         goto failure;
-    }

     if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
-                                      NULL) == NULL) {
+                                      NULL) == NULL)
         goto failure;
-    }

     /* x86_64 guest */
     guest =
@@ -54,14 +51,12 @@ testCapsInit(void)
                               VIR_ARCH_X86_64,
                               NULL, NULL, 0, NULL);

-    if (guest == NULL) {
+    if (guest == NULL)
         goto failure;
-    }

     if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
-                                      NULL) == NULL) {
+                                      NULL) == NULL)
         goto failure;
-    }

     return;

@@ -128,9 +123,8 @@ testCompareHelper(const void *data)
     if (virAsprintf(&vmx, "%s/vmx2xmldata/vmx2xml-%s.vmx", abs_srcdir,
                     info->input) < 0 ||
         virAsprintf(&xml, "%s/vmx2xmldata/vmx2xml-%s.xml", abs_srcdir,
-                    info->output) < 0) {
+                    info->output) < 0)
         goto cleanup;
-    }

     ret = testCompareFiles(vmx, xml);

@@ -159,9 +153,8 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
         /* Expected format: '/vmfs/volumes/<datastore>/<path>' */
         if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL ||
             (datastoreName = strtok_r(tmp, "/", &saveptr)) == NULL ||
-            (directoryAndFileName = strtok_r(NULL, "", &saveptr)) == NULL) {
+            (directoryAndFileName = strtok_r(NULL, "", &saveptr)) == NULL)
             goto cleanup;
-        }

         if (virAsprintf(&src, "[%s] %s", datastoreName,
                         directoryAndFileName) < 0)
@@ -201,9 +194,8 @@ mymain(void)

     testCapsInit();

-    if (caps == NULL) {
+    if (caps == NULL)
         return EXIT_FAILURE;
-    }

     if (!(xmlopt = virVMXDomainXMLConfInit()))
         return EXIT_FAILURE;
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 7d9e780..b74f00b 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -82,9 +82,8 @@ testCompareHelper(const void *data)
     if (virAsprintf(&xml, "%s/xml2sexprdata/xml2sexpr-%s.xml",
                     abs_srcdir, info->input) < 0 ||
         virAsprintf(&args, "%s/xml2sexprdata/xml2sexpr-%s.sexpr",
-                    abs_srcdir, info->output) < 0) {
+                    abs_srcdir, info->output) < 0)
         goto cleanup;
-    }

     result = testCompareFiles(xml, args, info->version);

diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 58418dc..17b2520 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -27,9 +27,8 @@ testCapsInit(void)

     caps = virCapabilitiesNew(VIR_ARCH_I686, true, true);

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

     virCapabilitiesAddHostMigrateTransport(caps, "esx");

@@ -40,14 +39,12 @@ testCapsInit(void)
                               VIR_ARCH_I686,
                               NULL, NULL, 0, NULL);

-    if (guest == NULL) {
+    if (guest == NULL)
         goto failure;
-    }

     if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
-                                      NULL) == NULL) {
+                                      NULL) == NULL)
         goto failure;
-    }

     /* x86_64 guest */
     guest =
@@ -55,14 +52,12 @@ testCapsInit(void)
                               VIR_ARCH_X86_64,
                               NULL, NULL, 0, NULL);

-    if (guest == NULL) {
+    if (guest == NULL)
         goto failure;
-    }

     if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
-                                      NULL) == NULL) {
+                                      NULL) == NULL)
         goto failure;
-    }

     return;

@@ -81,21 +76,18 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
     char *formatted = NULL;
     virDomainDefPtr def = NULL;

-    if (virtTestLoadFile(xml, &xmlData) < 0) {
+    if (virtTestLoadFile(xml, &xmlData) < 0)
         goto failure;
-    }

-    if (virtTestLoadFile(vmx, &vmxData) < 0) {
+    if (virtTestLoadFile(vmx, &vmxData) < 0)
         goto failure;
-    }

     def = virDomainDefParseString(xmlData, caps, xmlopt,
                                   1 << VIR_DOMAIN_VIRT_VMWARE,
                                   VIR_DOMAIN_XML_INACTIVE);

-    if (def == NULL) {
+    if (def == NULL)
         goto failure;
-    }

     if (!virDomainDefCheckABIStability(def, def)) {
         fprintf(stderr, "ABI stability check failed on %s", xml);
@@ -104,9 +96,8 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)

     formatted = virVMXFormatConfig(&ctx, xmlopt, def, virtualHW_version);

-    if (formatted == NULL) {
+    if (formatted == NULL)
         goto failure;
-    }

     if (STRNEQ(vmxData, formatted)) {
         virtTestDifference(stderr, vmxData, formatted);
@@ -141,9 +132,8 @@ testCompareHelper(const void *data)
     if (virAsprintf(&xml, "%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir,
                     info->input) < 0 ||
         virAsprintf(&vmx, "%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir,
-                    info->output) < 0) {
+                    info->output) < 0)
         goto cleanup;
-    }

     result = testCompareFiles(xml, vmx, info->virtualHW_version);

@@ -181,9 +171,8 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)

         /* Expected format: '[<datastore>] <path>' where <path> is optional */
         if ((tmp = STRSKIP(copyOfDatastorePath, "[")) == NULL || *tmp == ']' ||
-            (datastoreName = strtok_r(tmp, "]", &saveptr)) == NULL) {
+            (datastoreName = strtok_r(tmp, "]", &saveptr)) == NULL)
             goto cleanup;
-        }

         directoryAndFileName = strtok_r(NULL, "", &saveptr);

@@ -207,9 +196,8 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
     success = true;

  cleanup:
-    if (! success) {
+    if (! success)
         VIR_FREE(absolutePath);
-    }

     VIR_FREE(copyOfDatastorePath);

@@ -233,9 +221,8 @@ mymain(void)

     testCapsInit();

-    if (caps == NULL) {
+    if (caps == NULL)
         return EXIT_FAILURE;
-    }

     if (!(xmlopt = virVMXDomainXMLConfInit()))
         return EXIT_FAILURE;
-- 
2.1.3




More information about the libvir-list mailing list