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/access/viraccessdriverstack.c | 3 +--
src/bhyve/bhyve_driver.c | 3 +--
src/cpu/cpu_powerpc.c | 3 +--
src/cpu/cpu_x86.c | 3 +--
src/datatypes.c | 6 ++----
src/driver.c | 3 +--
src/interface/interface_backend_udev.c | 15 +++++----------
src/libvirt-domain.c | 6 ++----
src/libvirt-lxc.c | 3 +--
src/libvirt-nodedev.c | 3 +--
src/libvirt-storage.c | 6 ++----
src/libxl/libxl_conf.c | 3 +--
src/libxl/libxl_driver.c | 12 ++++--------
src/locking/lock_daemon.c | 9 +++------
src/locking/lock_driver_sanlock.c | 6 ++----
src/lxc/lxc_container.c | 12 ++++--------
src/lxc/lxc_driver.c | 12 ++++--------
src/lxc/lxc_process.c | 6 ++----
18 files changed, 38 insertions(+), 76 deletions(-)
diff --git a/src/access/viraccessdriverstack.c b/src/access/viraccessdriverstack.c
index 11ed4f6..b43a743 100644
--- a/src/access/viraccessdriverstack.c
+++ b/src/access/viraccessdriverstack.c
@@ -54,9 +54,8 @@ static void virAccessDriverStackCleanup(virAccessManagerPtr manager)
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager);
size_t i;
- for (i = 0; i < priv->managersLen; i++) {
+ for (i = 0; i < priv->managersLen; i++)
virObjectUnref(priv->managers[i]);
- }
VIR_FREE(priv->managers);
}
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index eb0d455..12067dd 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1153,9 +1153,8 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED,
return 0;
}
- if (VIR_ALLOC(bhyve_driver) < 0) {
+ if (VIR_ALLOC(bhyve_driver) < 0)
return -1;
- }
if (virMutexInit(&bhyve_driver->lock) < 0) {
VIR_FREE(bhyve_driver);
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 67cb9ff..493432a 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -487,9 +487,8 @@ ppcDecode(virCPUDefPtr cpu,
}
if (VIR_STRDUP(cpu->model, model->name) < 0 ||
- (model->vendor && VIR_STRDUP(cpu->vendor,
model->vendor->name) < 0)) {
+ (model->vendor && VIR_STRDUP(cpu->vendor,
model->vendor->name) < 0))
goto cleanup;
- }
ret = 0;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 026b54e..b0e7c49 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1765,9 +1765,8 @@ x86Encode(virArch arch,
if (v &&
(VIR_ALLOC(data_vendor) < 0 ||
- virCPUx86DataAddCPUID(data_vendor, &v->cpuid) < 0)) {
+ virCPUx86DataAddCPUID(data_vendor, &v->cpuid) < 0))
goto error;
- }
}
if (forced &&
diff --git a/src/datatypes.c b/src/datatypes.c
index 87e3550..b4f6765 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -450,9 +450,8 @@ virStoragePoolDispose(void *obj)
virUUIDFormat(pool->uuid, uuidstr);
VIR_DEBUG("release pool %p %s %s", pool, pool->name, uuidstr);
- if (pool->privateDataFreeFunc) {
+ if (pool->privateDataFreeFunc)
pool->privateDataFreeFunc(pool->privateData);
- }
VIR_FREE(pool->name);
virObjectUnref(pool->conn);
@@ -525,9 +524,8 @@ virStorageVolDispose(void *obj)
virStorageVolPtr vol = obj;
VIR_DEBUG("release vol %p %s", vol, vol->name);
- if (vol->privateDataFreeFunc) {
+ if (vol->privateDataFreeFunc)
vol->privateDataFreeFunc(vol->privateData);
- }
VIR_FREE(vol->key);
VIR_FREE(vol->name);
diff --git a/src/driver.c b/src/driver.c
index 71569e6..1be32ef 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -85,9 +85,8 @@ virDriverLoadModule(const char *name)
*tmp = c_toupper(*tmp);
}
- if (virAsprintfQuiet(®func, "%sRegister", fixedname) < 0) {
+ if (virAsprintfQuiet(®func, "%sRegister", fixedname) < 0)
goto cleanup;
- }
regsym = dlsym(handle, regfunc);
if (!regsym) {
diff --git a/src/interface/interface_backend_udev.c
b/src/interface/interface_backend_udev.c
index 1dbbfe7..401697f 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -391,9 +391,8 @@ udevConnectListAllInterfaces(virConnectPtr conn,
devices = udev_enumerate_get_list_entry(enumerate);
/* For each item so we can count */
- udev_list_entry_foreach(dev_entry, devices) {
+ udev_list_entry_foreach(dev_entry, devices)
count++;
- }
/* If we've got nothing, exit out */
if (count == 0) {
@@ -845,9 +844,8 @@ udevGetIfaceDefBond(struct udev *udev,
return 0;
error:
- for (i = 0; slave_count != -1 && i < slave_count; i++) {
+ for (i = 0; slave_count != -1 && i < slave_count; i++)
VIR_FREE(slave_list[i]);
- }
VIR_FREE(slave_list);
return -1;
@@ -952,9 +950,8 @@ udevGetIfaceDefBridge(struct udev *udev,
return 0;
error:
- for (i = 0; member_count != -1 && i < member_count; i++) {
+ for (i = 0; member_count != -1 && i < member_count; i++)
VIR_FREE(member_list[i]);
- }
VIR_FREE(member_list);
return -1;
@@ -1102,14 +1099,12 @@ udevGetIfaceDef(struct udev *udev, const char *name)
* to prevent false positives
*/
vlan_parent_dev = strrchr(name, '.');
- if (vlan_parent_dev) {
+ if (vlan_parent_dev)
ifacedef->type = VIR_INTERFACE_TYPE_VLAN;
- }
/* Fallback check to see if this is a bond device */
- if (udev_device_get_sysattr_value(dev, "bonding/mode")) {
+ if (udev_device_get_sysattr_value(dev, "bonding/mode"))
ifacedef->type = VIR_INTERFACE_TYPE_BOND;
- }
}
switch (ifacedef->type) {
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 2b0defc..427f77a 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -4063,9 +4063,8 @@ virDomainMigrate3(virDomainPtr domain,
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_XML, &dxml) < 0 ||
virTypedParamsGetULLong(params, nparams,
- VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0) {
+ VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0)
goto error;
- }
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
VIR_DRV_FEATURE_MIGRATION_V3) &&
@@ -4492,9 +4491,8 @@ virDomainMigrateToURI3(virDomainPtr domain,
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_XML, &dxml) < 0 ||
virTypedParamsGetULLong(params, nparams,
- VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0) {
+ VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0)
goto error;
- }
if (flags & VIR_MIGRATE_PEER2PEER) {
if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c
index 58892df..8553570 100644
--- a/src/libvirt-lxc.c
+++ b/src/libvirt-lxc.c
@@ -145,9 +145,8 @@ virDomainLxcEnterNamespace(virDomainPtr domain,
if (virProcessSetNamespaces(nfdlist, fdlist) < 0) {
if (oldfdlist && noldfdlist) {
- for (i = 0; i < *noldfdlist; i++) {
+ for (i = 0; i < *noldfdlist; i++)
VIR_FORCE_CLOSE((*oldfdlist)[i]);
- }
VIR_FREE(*oldfdlist);
*noldfdlist = 0;
}
diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
index c19aeef..b6c6d1e 100644
--- a/src/libvirt-nodedev.c
+++ b/src/libvirt-nodedev.c
@@ -741,9 +741,8 @@ virNodeDeviceDestroy(virNodeDevicePtr dev)
if (dev->conn->nodeDeviceDriver &&
dev->conn->nodeDeviceDriver->nodeDeviceDestroy) {
int retval = dev->conn->nodeDeviceDriver->nodeDeviceDestroy(dev);
- if (retval < 0) {
+ if (retval < 0)
goto error;
- }
return 0;
}
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 190c718..54c7332 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -1746,9 +1746,8 @@ virStorageVolWipe(virStorageVolPtr vol,
if (conn->storageDriver && conn->storageDriver->storageVolWipe) {
int ret;
ret = conn->storageDriver->storageVolWipe(vol, flags);
- if (ret < 0) {
+ if (ret < 0)
goto error;
- }
return ret;
}
@@ -1789,9 +1788,8 @@ virStorageVolWipePattern(virStorageVolPtr vol,
if (conn->storageDriver &&
conn->storageDriver->storageVolWipePattern) {
int ret;
ret = conn->storageDriver->storageVolWipePattern(vol, algorithm, flags);
- if (ret < 0) {
+ if (ret < 0)
goto error;
- }
return ret;
}
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e296ffc..3c200ef 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -675,9 +675,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
VIR_TRISTATE_SWITCH_ON);
for (i = 0; i < def->clock.ntimers; i++) {
if (def->clock.timers[i]->name == VIR_DOMAIN_TIMER_NAME_HPET
&&
- def->clock.timers[i]->present == 1) {
+ def->clock.timers[i]->present == 1)
libxl_defbool_set(&b_info->u.hvm.hpet, 1);
- }
}
for (i = 0; i < def->os.nBootDevs; i++) {
switch (def->os.bootDevs[i]) {
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d2c077c..8cbf3c0 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -246,9 +246,8 @@ libxlDriverShouldLoad(bool privileged)
* xenfs to /proc/xen.
*/
status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
- if (status >= 0) {
+ if (status >= 0)
status = strncmp(output, "control_d", 9);
- }
VIR_FREE(output);
if (status) {
VIR_INFO("No Xen capabilities detected, probably not running "
@@ -1792,9 +1791,8 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
- if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM) && vm->def->maxvcpus <
max) {
+ if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM) && vm->def->maxvcpus <
max)
max = vm->def->maxvcpus;
- }
if (nvcpus > max) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -1964,9 +1962,8 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
&flags, &targetDef) < 0)
goto endjob;
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE)
targetDef = vm->def;
- }
/* Make sure coverity knows targetDef is valid at this point. */
sa_assert(targetDef);
@@ -2066,9 +2063,8 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
&flags, &targetDef) < 0)
goto cleanup;
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE)
targetDef = vm->def;
- }
/* Make sure coverity knows targetDef is valid at this point. */
sa_assert(targetDef);
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 75244e8..bb34f06 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -225,9 +225,8 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool
privileged)
if (virHashAddEntry(lockd->lockspaces,
virLockSpaceGetDirectory(lockspace),
- lockspace) < 0) {
+ lockspace) < 0)
virLockSpaceFree(lockspace);
- }
}
if (!(child = virJSONValueObjectGet(object, "server"))) {
@@ -343,9 +342,8 @@ virLockDaemonForkIntoBackground(const char *argv0)
/* We wait to make sure the first child forked successfully */
if ((got = waitpid(pid, &exitstatus, 0)) < 0 ||
got != pid ||
- exitstatus != 0) {
+ exitstatus != 0)
return -1;
- }
/* Now block until the second child initializes successfully */
again:
@@ -1160,9 +1158,8 @@ int main(int argc, char **argv) {
c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
- if (c == -1) {
+ if (c == -1)
break;
- }
switch (c) {
case 0:
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 0318f25..d84a419 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -1008,9 +1008,8 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
VIR_DEBUG("Acquire completed fd=%d", sock);
if (res_free) {
- for (i = 0; i < res_count; i++) {
+ for (i = 0; i < res_count; i++)
VIR_FREE(res_args[i]);
- }
VIR_FREE(res_args);
}
@@ -1021,9 +1020,8 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
error:
if (res_free) {
- for (i = 0; i < res_count; i++) {
+ for (i = 0; i < res_count; i++)
VIR_FREE(res_args[i]);
- }
VIR_FREE(res_args);
}
VIR_FREE(opt);
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 8aba3ba..0229ee0 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -396,9 +396,8 @@ int lxcContainerSendContinue(int control)
VIR_DEBUG("Send continue on fd %d", control);
writeCount = safewrite(control, &msg, sizeof(msg));
- if (writeCount != sizeof(msg)) {
+ if (writeCount != sizeof(msg))
goto error_out;
- }
rc = 0;
error_out:
@@ -858,14 +857,12 @@ static int lxcContainerMountBasicFS(bool userns_enabled,
*/
if (userns_enabled && netns_disabled &&
STREQ(mnt->src, "sysfs")) {
- if (VIR_STRDUP(mnt_src, "/sys") < 0) {
+ if (VIR_STRDUP(mnt_src, "/sys") < 0)
goto cleanup;
- }
mnt_mflags = MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY|MS_BIND;
} else {
- if (VIR_STRDUP(mnt_src, mnt->src) < 0) {
+ if (VIR_STRDUP(mnt_src, mnt->src) < 0)
goto cleanup;
- }
mnt_mflags = mnt->mflags;
}
@@ -2128,9 +2125,8 @@ static int lxcContainerChild(void *data)
/* rename and enable interfaces */
if (lxcContainerRenameAndEnableInterfaces(vmDef,
argv->nveths,
- argv->veths) < 0) {
+ argv->veths) < 0)
goto cleanup;
- }
/* drop a set of root capabilities */
if (lxcContainerDropCapabilities(vmDef, !!hasReboot) < 0)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 6a58d50..10bae70 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1582,9 +1582,8 @@ static int lxcStateInitialize(bool privileged,
return 0;
}
- if (VIR_ALLOC(lxc_driver) < 0) {
+ if (VIR_ALLOC(lxc_driver) < 0)
return -1;
- }
if (virMutexInit(&lxc_driver->lock) < 0) {
VIR_FREE(lxc_driver);
return -1;
@@ -1968,9 +1967,8 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
vm->def->cputune.period = params[i].value.ul;
}
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG)
vmdef->cputune.period = params[i].value.ul;
- }
} else if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_VCPU_QUOTA)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
rc = lxcSetVcpuBWLive(priv->cgroup, 0, params[i].value.l);
@@ -1981,9 +1979,8 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom,
vm->def->cputune.quota = params[i].value.l;
}
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG)
vmdef->cputune.quota = params[i].value.l;
- }
}
}
@@ -4017,9 +4014,8 @@ lxcDomainAttachDeviceUnlink(virDomainObjPtr vm,
if (virProcessRunInMountNamespace(priv->initpid,
lxcDomainAttachDeviceUnlinkHelper,
- file) < 0) {
+ file) < 0)
return -1;
- }
return 0;
}
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 6c83fdb..37ddbbc 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -536,9 +536,8 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
if (vm)
virObjectUnlock(vm);
- if (event) {
+ if (event)
virObjectEventStateQueue(driver->domainEventState, event);
- }
}
static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED,
@@ -826,9 +825,8 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver,
virCommandAddArgFormat(cmd, "%d", handshakefd);
virCommandAddArg(cmd, "--background");
- for (i = 0; i < nveths; i++) {
+ for (i = 0; i < nveths; i++)
virCommandAddArgList(cmd, "--veth", veths[i], NULL);
- }
virCommandPassFD(cmd, handshakefd, 0);
--
2.1.3