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(a)redhat.com>
---
src/security/security_dac.c | 9 ++---
src/security/security_manager.c | 3 +-
src/security/security_selinux.c | 6 ++--
src/security/virt-aa-helper.c | 15 +++------
src/storage/parthelper.c | 3 +-
src/storage/storage_backend.c | 9 ++---
src/storage/storage_backend_disk.c | 21 ++++--------
src/storage/storage_backend_fs.c | 9 ++---
src/storage/storage_backend_mpath.c | 30 ++++++-----------
src/storage/storage_backend_rbd.c | 30 ++++++-----------
src/storage/storage_backend_scsi.c | 9 ++---
src/storage/storage_driver.c | 9 ++---
src/test/test_driver.c | 66 +++++++++++++------------------------
13 files changed, 73 insertions(+), 146 deletions(-)
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 85253af..208f6e2 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -774,13 +774,11 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
goto done;
if (virFileExists(in) && virFileExists(out)) {
if ((virSecurityDACSetOwnership(in, user, group) < 0) ||
- (virSecurityDACSetOwnership(out, user, group) < 0)) {
+ (virSecurityDACSetOwnership(out, user, group) < 0))
goto done;
- }
} else if (virSecurityDACSetOwnership(dev_source->data.file.path,
- user, group) < 0) {
+ user, group) < 0)
goto done;
- }
ret = 0;
break;
@@ -834,9 +832,8 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr
ATTRIBUTE_UNUSED,
goto done;
if (virFileExists(in) && virFileExists(out)) {
if ((virSecurityDACRestoreSecurityFileLabel(out) < 0) ||
- (virSecurityDACRestoreSecurityFileLabel(in) < 0)) {
+ (virSecurityDACRestoreSecurityFileLabel(in) < 0))
goto done;
- }
} else if (virSecurityDACRestoreSecurityFileLabel(dev_source->data.file.path)
< 0) {
goto done;
}
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 8671620..302f54d 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -875,9 +875,8 @@ virSecurityManagerGetNested(virSecurityManagerPtr mgr)
{
virSecurityManagerPtr* list = NULL;
- if (STREQ("stack", mgr->drv->name)) {
+ if (STREQ("stack", mgr->drv->name))
return virSecurityStackGetNested(mgr);
- }
if (VIR_ALLOC_N(list, 2) < 0)
return NULL;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index f96be50..d140fb8 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1719,9 +1719,8 @@ virSecuritySELinuxSetSecurityChardevLabel(virDomainDefPtr def,
goto done;
if (virFileExists(in) && virFileExists(out)) {
if ((virSecuritySELinuxSetFilecon(in, imagelabel) < 0) ||
- (virSecuritySELinuxSetFilecon(out, imagelabel) < 0)) {
+ (virSecuritySELinuxSetFilecon(out, imagelabel) < 0))
goto done;
- }
} else if (virSecuritySELinuxSetFilecon(dev_source->data.file.path,
imagelabel) < 0) {
goto done;
@@ -1784,9 +1783,8 @@ virSecuritySELinuxRestoreSecurityChardevLabel(virSecurityManagerPtr
mgr,
goto done;
if (virFileExists(in) && virFileExists(out)) {
if ((virSecuritySELinuxRestoreSecurityFileLabel(mgr, out) < 0) ||
- (virSecuritySELinuxRestoreSecurityFileLabel(mgr, in) < 0)) {
+ (virSecuritySELinuxRestoreSecurityFileLabel(mgr, in) < 0))
goto done;
- }
} else if (virSecuritySELinuxRestoreSecurityFileLabel(mgr,
dev_source->data.file.path) < 0) {
goto done;
}
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 1f299a0..6fc7474 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -667,9 +667,8 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
char *arch;
if (!(xml = virXMLParseStringCtxt(xmlStr, _("(domain_definition)"),
- &ctxt))) {
+ &ctxt)))
goto cleanup;
- }
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "domain")) {
vah_error(NULL, 0, _("unexpected root element, expecting
<domain>"));
@@ -1061,9 +1060,8 @@ get_files(vahControl * ctl)
virDomainHostdevSubsysPCIBackendType backend =
dev->source.subsys.u.pci.backend;
if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO ||
- backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
+ backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
needsVfio = true;
- }
if (pci == NULL)
continue;
@@ -1253,13 +1251,11 @@ main(int argc, char **argv)
/* clear the environment */
environ = NULL;
- if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0) {
+ if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0)
vah_error(ctl, 1, _("could not set PATH"));
- }
- if (setenv("IFS", " \t\n", 1) != 0) {
+ if (setenv("IFS", " \n\t", 1) != 0)
vah_error(ctl, 1, _("could not set IFS"));
- }
if (!(progname = strrchr(argv[0], '/')))
progname = argv[0];
@@ -1290,9 +1286,8 @@ main(int argc, char **argv)
} else if (ctl->cmd == 'c' || ctl->cmd == 'r') {
char *included_files = NULL;
- if (ctl->cmd == 'c' && virFileExists(profile)) {
+ if (ctl->cmd == 'c' && virFileExists(profile))
vah_error(ctl, 1, _("profile exists"));
- }
if (ctl->append && ctl->newfile) {
if (vah_add_file(&buf, ctl->newfile, "rw") != 0)
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 84e7ba0..8de32fd 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -91,9 +91,8 @@ int main(int argc, char **argv)
if (VIR_STRDUP_QUIET(canonical_path, path) < 0)
return 2;
} else {
- if (virFileResolveLink(path, &canonical_path) != 0) {
+ if (virFileResolveLink(path, &canonical_path) != 0)
return 2;
- }
partsep = *canonical_path &&
c_isdigit(canonical_path[strlen(canonical_path)-1]) ? "p" :
"";
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 00cfe74..98720f6 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -182,9 +182,8 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
}
#ifdef __linux__
- if (ioctl(fd, BLKBSZGET, &wbytes) < 0) {
+ if (ioctl(fd, BLKBSZGET, &wbytes) < 0)
wbytes = 0;
- }
#endif
if ((wbytes == 0) && fstat(fd, &st) == 0)
wbytes = st.st_blksize;
@@ -395,9 +394,8 @@ createRawFile(int fd, virStorageVolDefPtr vol,
(vol->target.allocation < inputvol->target.capacity);
ret = virStorageBackendCopyToFD(vol, inputvol, fd, &remain, want_sparse);
- if (ret < 0) {
+ if (ret < 0)
goto cleanup;
- }
}
if (remain && need_alloc) {
@@ -631,9 +629,8 @@ virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
virCommandSetGID(cmd, -1);
if (!filecreated) {
- if (virCommandRun(cmd, NULL) < 0) {
+ if (virCommandRun(cmd, NULL) < 0)
return -1;
- }
if (stat(vol->target.path, &st) < 0) {
virReportSystemError(errno,
_("failed to create %s"),
vol->target.path);
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index abab1e1..0546b10 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -171,9 +171,8 @@ virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
return -1; /* Don't bother to re-alloc freeExtents - it'll be free'd
shortly */
/* first block reported as free, even if it is not */
- if (dev->freeExtents[dev->nfreeExtent].start == 0) {
+ if (dev->freeExtents[dev->nfreeExtent].start == 0)
dev->freeExtents[dev->nfreeExtent].start = SECTOR_SIZE;
- }
pool->def->available +=
(dev->freeExtents[dev->nfreeExtent].end -
@@ -349,9 +348,8 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
return -1;
}
- if (virStorageBackendDiskReadGeometry(pool) != 0) {
+ if (virStorageBackendDiskReadGeometry(pool) != 0)
return -1;
- }
return virStorageBackendDiskReadPartitions(pool, NULL);
}
@@ -467,9 +465,8 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool)
partType == VIR_STORAGE_VOL_DISK_TYPE_EXTENDED)
count++;
}
- if (count >= 4) {
+ if (count >= 4)
return VIR_STORAGE_VOL_DISK_TYPE_LOGICAL;
- }
}
/* for all other cases, all partitions are primary */
@@ -587,9 +584,8 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
}
/* if we are creating a logical partition, we need one extra
block between partitions (or actually move start one block) */
- if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL) {
+ if (partType == VIR_STORAGE_VOL_DISK_TYPE_LOGICAL)
size -= SECTOR_SIZE;
- }
}
if (size > neededSize &&
(smallestSize == 0 ||
@@ -602,9 +598,8 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool,
/* for primary partition, the free extent
must not be within a logical free area */
} else if (partType == VIR_STORAGE_VOL_DISK_TYPE_PRIMARY &&
- dev->freeExtents[i].type != VIR_STORAGE_FREE_NORMAL) {
+ dev->freeExtents[i].type != VIR_STORAGE_FREE_NORMAL)
continue;
- }
smallestSize = size;
smallestExtent = i;
alignedAllocation = neededSize;
@@ -659,16 +654,14 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0) {
+ if (virStorageBackendDiskPartFormat(pool, vol, &partFormat) != 0)
goto cleanup;
- }
virCommandAddArg(cmd, partFormat);
if (virStorageBackendDiskPartBoundaries(pool, &startOffset,
&endOffset,
- vol->target.capacity) != 0) {
+ vol->target.capacity) != 0)
goto cleanup;
- }
virCommandAddArgFormat(cmd, "%lluB", startOffset);
virCommandAddArgFormat(cmd, "%lluB", endOffset);
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 0f8ceee..71c941b 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -639,9 +639,8 @@ virStorageBackendFileSystemProbe(const char *device,
error:
VIR_FREE(libblkid_format);
- if (probe != NULL) {
+ if (probe != NULL)
blkid_free_probe(probe);
- }
return ret;
}
@@ -733,13 +732,11 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool,
ok_to_mkfs = true;
} else if (flags & VIR_STORAGE_POOL_BUILD_NO_OVERWRITE &&
virStorageBackendFileSystemProbe(device, format) ==
- FILESYSTEM_PROBE_NOT_FOUND) {
+ FILESYSTEM_PROBE_NOT_FOUND)
ok_to_mkfs = true;
- }
- if (ok_to_mkfs) {
+ if (ok_to_mkfs)
ret = virStorageBackendExecuteMKFS(device, format);
- }
error:
return ret;
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index f21ae4c..828ebd4 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -61,9 +61,8 @@ virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
goto cleanup;
if (virStorageBackendUpdateVolInfo(vol, true, true,
- VIR_STORAGE_VOL_OPEN_DEFAULT) < 0) {
+ VIR_STORAGE_VOL_OPEN_DEFAULT) < 0)
goto cleanup;
- }
/* XXX should use logical unit's UUID instead */
if (VIR_STRDUP(vol->key, vol->target.path) < 0)
@@ -119,14 +118,12 @@ virStorageBackendIsMultipath(const char *dev_name)
goto out;
}
- if (STREQ(target_type, "multipath")) {
+ if (STREQ(target_type, "multipath"))
ret = 1;
- }
out:
- if (dmt != NULL) {
+ if (dmt != NULL)
dm_task_destroy(dmt);
- }
return ret;
}
@@ -138,21 +135,17 @@ virStorageBackendGetMinorNumber(const char *dev_name, uint32_t
*minor)
struct dm_task *dmt;
struct dm_info info;
- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) {
+ if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
goto out;
- }
- if (!dm_task_set_name(dmt, dev_name)) {
+ if (!dm_task_set_name(dmt, dev_name))
goto out;
- }
- if (!dm_task_run(dmt)) {
+ if (!dm_task_run(dmt))
goto out;
- }
- if (!dm_task_get_info(dmt, &info)) {
+ if (!dm_task_get_info(dmt, &info))
goto out;
- }
*minor = info.minor;
ret = 0;
@@ -177,9 +170,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
do {
is_mpath = virStorageBackendIsMultipath(names->name);
- if (is_mpath < 0) {
+ if (is_mpath < 0)
goto out;
- }
if (is_mpath == 1) {
@@ -193,9 +185,8 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
goto out;
}
- if (virStorageBackendMpathNewVol(pool, minor, map_device) < 0) {
+ if (virStorageBackendMpathNewVol(pool, minor, map_device) < 0)
goto out;
- }
VIR_FREE(map_device);
}
@@ -247,9 +238,8 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool)
virStorageBackendCreateVols(pool, names);
out:
- if (dmt != NULL) {
+ if (dmt != NULL)
dm_task_destroy(dmt);
- }
return retval;
}
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index bddbc1d..5a16eff 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -330,13 +330,11 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn,
ptr.cluster = NULL;
ptr.ioctx = NULL;
- if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0) {
+ if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0)
goto cleanup;
- }
- if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+ if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
goto cleanup;
- }
struct rados_cluster_stat_t clusterstat;
r = rados_cluster_stat(ptr.cluster, &clusterstat);
@@ -428,17 +426,14 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
VIR_DEBUG("Removing RBD image %s/%s", pool->def->source.name,
vol->name);
- if (flags & VIR_STORAGE_VOL_DELETE_ZEROED) {
+ if (flags & VIR_STORAGE_VOL_DELETE_ZEROED)
VIR_WARN("%s", _("This storage backend does not supported zeroed
removal of volumes"));
- }
- if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0) {
+ if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0)
goto cleanup;
- }
- if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+ if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
goto cleanup;
- }
r = rbd_remove(ptr.ioctx, vol->name);
if (r < 0) {
@@ -555,17 +550,14 @@ static int virStorageBackendRBDRefreshVol(virConnectPtr conn,
ptr.ioctx = NULL;
int ret = -1;
- if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0) {
+ if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0)
goto cleanup;
- }
- if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+ if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
goto cleanup;
- }
- if (volStorageBackendRBDRefreshVolInfo(vol, pool, &ptr) < 0) {
+ if (volStorageBackendRBDRefreshVolInfo(vol, pool, &ptr) < 0)
goto cleanup;
- }
ret = 0;
@@ -589,13 +581,11 @@ static int virStorageBackendRBDResizeVol(virConnectPtr conn
ATTRIBUTE_UNUSED,
virCheckFlags(0, -1);
- if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0) {
+ if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source)
< 0)
goto cleanup;
- }
- if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0) {
+ if (virStorageBackendRBDOpenIoCTX(&ptr, pool) < 0)
goto cleanup;
- }
r = rbd_open(ptr.ioctx, vol->name, &image, NULL);
if (r < 0) {
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 02160bc..fb4288b 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -255,9 +255,8 @@ getNewStyleBlockDevice(const char *lun_path,
while ((direrr = virDirRead(block_dir, &block_dirent, block_path)) > 0) {
- if (STREQLEN(block_dirent->d_name, ".", 1)) {
+ if (STREQLEN(block_dirent->d_name, ".", 1))
continue;
- }
if (VIR_STRDUP(*block_device, block_dirent->d_name) < 0) {
closedir(block_dir);
@@ -396,9 +395,8 @@ processLU(virStoragePoolObjPtr pool,
VIR_DEBUG("%u:%u:%u:%u is a Direct-Access LUN",
host, bus, target, lun);
- if (getBlockDevice(host, bus, target, lun, &block_device) < 0) {
+ if (getBlockDevice(host, bus, target, lun, &block_device) < 0)
goto out;
- }
if (virStorageBackendSCSINewLun(pool,
host, bus, target, lun,
@@ -448,9 +446,8 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
while ((retval = virDirRead(devicedir, &lun_dirent, device_path)) > 0) {
if (sscanf(lun_dirent->d_name, devicepattern,
- &bus, &target, &lun) != 3) {
+ &bus, &target, &lun) != 3)
continue;
- }
found = true;
VIR_DEBUG("Found LU '%s'", lun_dirent->d_name);
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 7c518bf..dbd9141 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -493,9 +493,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
cleanup:
storageDriverUnlock(driver);
- for (i = 0; i < got; i++) {
+ for (i = 0; i < got; i++)
VIR_FREE(names[i]);
- }
memset(names, 0, nnames * sizeof(*names));
return -1;
}
@@ -1670,9 +1669,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
/* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
VIR_FREE(voldef->key);
- if (backend->createVol(obj->conn, pool, voldef) < 0) {
+ if (backend->createVol(obj->conn, pool, voldef) < 0)
goto cleanup;
- }
pool->volumes.objs[pool->volumes.count++] = voldef;
volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
@@ -1851,9 +1849,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
* Wipe any key the user may have suggested, as volume creation
* will generate the canonical key. */
VIR_FREE(newvol->key);
- if (backend->createVol(obj->conn, pool, newvol) < 0) {
+ if (backend->createVol(obj->conn, pool, newvol) < 0)
goto cleanup;
- }
pool->volumes.objs[pool->volumes.count++] = newvol;
volobj = virGetStorageVol(obj->conn, pool->def->name, newvol->name,
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2afd6fe..a185dea 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -672,9 +672,8 @@ testDomainStartState(testConnPtr privconn,
if (virDomainObjSetDefTransient(privconn->caps,
privconn->xmlopt,
- dom, false) < 0) {
+ dom, false) < 0)
goto cleanup;
- }
dom->hasManagedSave = false;
ret = 0;
@@ -960,9 +959,8 @@ testParseNodeInfo(virNodeInfoPtr nodeInfo, xmlXPathContextPtr ctxt)
nodeInfo->sockets * nodeInfo->nodes);
ret = virXPathLong("string(/node/cpu/active[1])", ctxt, &l);
if (ret == 0) {
- if (l < nodeInfo->cpus) {
+ if (l < nodeInfo->cpus)
nodeInfo->cpus = l;
- }
} else if (ret == -2) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid node cpu active value"));
@@ -1070,9 +1068,8 @@ testParseDomains(testConnPtr privconn,
virDomainObjPtr obj;
num = virXPathNodeSet("/node/domain", ctxt, &nodes);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
virDomainDefPtr def;
@@ -1137,9 +1134,8 @@ testParseNetworks(testConnPtr privconn,
virNetworkObjPtr obj;
num = virXPathNodeSet("/node/network", ctxt, &nodes);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
virNetworkDefPtr def;
@@ -1177,9 +1173,8 @@ testParseInterfaces(testConnPtr privconn,
virInterfaceObjPtr obj;
num = virXPathNodeSet("/node/interface", ctxt, &nodes);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
virInterfaceDefPtr def;
@@ -1225,9 +1220,8 @@ testOpenVolumesForPool(const char *file,
num = virXPathNodeSet(vol_xpath, ctxt, &nodes);
VIR_FREE(vol_xpath);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
xmlNodePtr node = testParseXMLDocFromFile(nodes[i], file,
@@ -1275,9 +1269,8 @@ testParseStorage(testConnPtr privconn,
virStoragePoolObjPtr obj;
num = virXPathNodeSet("/node/pool", ctxt, &nodes);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
virStoragePoolDefPtr def;
@@ -1328,9 +1321,8 @@ testParseNodedevs(testConnPtr privconn,
virNodeDeviceObjPtr obj;
num = virXPathNodeSet("/node/device", ctxt, &nodes);
- if (num < 0) {
+ if (num < 0)
goto error;
- }
for (i = 0; i < num; i++) {
virNodeDeviceDefPtr def;
@@ -1430,9 +1422,8 @@ testOpenFromFile(virConnectPtr conn, const char *file)
if (!(privconn->eventState = virObjectEventStateNew()))
goto error;
- if (!(doc = virXMLParseFileCtxt(file, &ctxt))) {
+ if (!(doc = virXMLParseFileCtxt(file, &ctxt)))
goto error;
- }
if (!xmlStrEqual(ctxt->node->name, BAD_CAST "node")) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -2713,9 +2704,8 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
case VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG:
ret = testDomainUpdateVCPUs(privconn, privdom, nrCpus, 0);
- if (ret == 0) {
+ if (ret == 0)
persistentDef->vcpus = nrCpus;
- }
break;
}
@@ -2806,9 +2796,8 @@ static int testDomainGetVcpus(virDomainPtr domain,
unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
for (i = 0; i < maxcpu; i++) {
- if (VIR_CPU_USABLE(privdomdata->cpumaps, privmaplen, v, i)) {
+ if (VIR_CPU_USABLE(privdomdata->cpumaps, privmaplen, v, i))
VIR_USE_CPU(cpumap, i);
- }
}
}
}
@@ -2866,9 +2855,8 @@ static int testDomainPinVcpu(virDomainPtr domain,
memset(privcpumap, 0, privmaplen);
for (i = 0; i < maxcpu; i++) {
- if (VIR_CPU_USABLE(cpumap, maplen, 0, i)) {
+ if (VIR_CPU_USABLE(cpumap, maplen, 0, i))
VIR_USE_CPU(privcpumap, i);
- }
}
ret = 0;
@@ -3070,9 +3058,8 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn,
for (cell = startCell, i = 0;
(cell < privconn->numCells && i < maxCells);
- ++cell, ++i) {
+ ++cell, ++i)
freemems[i] = privconn->cells[cell].mem;
- }
ret = i;
cleanup:
@@ -4068,9 +4055,8 @@ static int testConnectNumOfInterfaces(virConnectPtr conn)
testDriverLock(privconn);
for (i = 0; (i < privconn->ifaces.count); i++) {
virInterfaceObjLock(privconn->ifaces.objs[i]);
- if (virInterfaceObjIsActive(privconn->ifaces.objs[i])) {
+ if (virInterfaceObjIsActive(privconn->ifaces.objs[i]))
count++;
- }
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
}
testDriverUnlock(privconn);
@@ -4115,9 +4101,8 @@ static int testConnectNumOfDefinedInterfaces(virConnectPtr conn)
testDriverLock(privconn);
for (i = 0; i < privconn->ifaces.count; i++) {
virInterfaceObjLock(privconn->ifaces.objs[i]);
- if (!virInterfaceObjIsActive(privconn->ifaces.objs[i])) {
+ if (!virInterfaceObjIsActive(privconn->ifaces.objs[i]))
count++;
- }
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
}
testDriverUnlock(privconn);
@@ -6066,21 +6051,18 @@ testNodeDeviceCreateXML(virConnectPtr conn,
testDriverLock(driver);
def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE, NULL);
- if (def == NULL) {
+ if (def == NULL)
goto cleanup;
- }
/* We run these next two simply for validation */
- if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1) {
+ if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
goto cleanup;
- }
if (virNodeDeviceGetParentHost(&driver->devs,
def->name,
def->parent,
- &parent_host) == -1) {
+ &parent_host) == -1)
goto cleanup;
- }
/* 'name' is supposed to be filled in by the node device backend, which
* we don't have. Use WWPN instead. */
@@ -6101,9 +6083,8 @@ testNodeDeviceCreateXML(virConnectPtr conn,
}
- if (!(obj = virNodeDeviceAssignDef(&driver->devs, def))) {
+ if (!(obj = virNodeDeviceAssignDef(&driver->devs, def)))
goto cleanup;
- }
virNodeDeviceObjUnlock(obj);
dev = virGetNodeDevice(conn, def->name);
@@ -6134,9 +6115,8 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
goto out;
}
- if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1) {
+ if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1)
goto out;
- }
if (VIR_STRDUP(parent_name, obj->def->parent) < 0)
goto out;
@@ -7045,9 +7025,8 @@ testDomainSnapshotReparentChildren(void *payload,
virDomainSnapshotObjPtr snap = payload;
testSnapReparentDataPtr rep = data;
- if (rep->err < 0) {
+ if (rep->err < 0)
return;
- }
VIR_FREE(snap->def->parent);
snap->parent = rep->parent;
@@ -7089,9 +7068,8 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
testDomainSnapshotDiscardAll,
&rem);
if (rem.current) {
- if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) {
+ if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
snap->def->current = true;
- }
vm->current_snapshot = snap;
}
} else if (snap->nchildren) {
--
2.1.3