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/uml/uml_conf.c | 6 ++----
src/uml/uml_driver.c | 9 +++------
src/vmware/vmware_conf.c | 9 +++------
src/vmware/vmware_driver.c | 6 ++----
src/xen/block_stats.c | 3 +--
src/xen/xen_driver.c | 6 ++----
src/xen/xen_hypervisor.c | 12 ++++--------
src/xen/xen_inotify.c | 3 +--
src/xen/xend_internal.c | 21 +++++++--------------
src/xen/xm_internal.c | 11 ++++-------
src/xenapi/xenapi_driver.c | 15 +++++----------
src/xenapi/xenapi_utils.c | 15 +++++----------
src/xenconfig/xen_common.c | 12 ++++--------
src/xenconfig/xen_sxpr.c | 12 ++++--------
src/xenconfig/xen_xm.c | 3 +--
15 files changed, 48 insertions(+), 95 deletions(-)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index a99e8e9..9dcd4ae 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -172,9 +172,8 @@ umlBuildCommandLineNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_ETHERNET:
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap,");
- if (def->ifname) {
+ if (def->ifname)
virBufferAdd(&buf, def->ifname, -1);
- }
if (def->data.ethernet.ipaddr) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet
interface"));
@@ -215,9 +214,8 @@ umlBuildCommandLineNet(virConnectPtr conn,
}
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
- if (bridge == NULL) {
+ if (bridge == NULL)
goto error;
- }
if (umlConnectTapDevice(conn, vm, def, bridge) < 0) {
VIR_FREE(bridge);
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 2baf2fa..b01d631 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -336,9 +336,8 @@ umlInotifyEvent(int watch,
dom = virDomainObjListFindByName(driver->domains, name);
- if (!dom) {
+ if (!dom)
continue;
- }
if (e.mask & IN_DELETE) {
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
@@ -1335,9 +1334,8 @@ static int umlGetProcessInfo(unsigned long long *cpuTime, pid_t
pid)
FILE *pidinfo;
unsigned long long usertime, systime;
- if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0) {
+ if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0)
return -1;
- }
if (!(pidinfo = fopen(proc, "r"))) {
/* VM probably shut down, so fake 0 */
@@ -2306,9 +2304,8 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver,
char *reply;
for (i = 0; i < vm->def->ndisks; i++) {
- if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst)) {
+ if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst))
break;
- }
}
if (i == vm->def->ndisks) {
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 81ac4ae..f855c1b 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -90,9 +90,8 @@ vmwareCapsInit(void)
cpu->type = VIR_CPU_TYPE_HOST;
if (!(data = cpuNodeData(cpu->arch))
- || cpuDecode(cpu, data, NULL, 0, NULL) < 0) {
+ || cpuDecode(cpu, data, NULL, 0, NULL) < 0)
goto error;
- }
/* x86_64 guests are supported if
* - Host arch is x86_64
@@ -163,9 +162,8 @@ vmwareLoadDomains(struct vmware_driver *driver)
goto cleanup;
if ((vmdef =
- virVMXParseConfig(&ctx, driver->xmlopt, vmx)) == NULL) {
+ virVMXParseConfig(&ctx, driver->xmlopt, vmx)) == NULL)
goto cleanup;
- }
if (!(vm = virDomainObjListAdd(driver->domains, vmdef,
driver->xmlopt,
@@ -432,9 +430,8 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
goto cleanup;
}
- if (vmwareParsePath(src, &directoryName, &fileName) < 0) {
+ if (vmwareParsePath(src, &directoryName, &fileName) < 0)
goto cleanup;
- }
if (!virFileHasSuffix(fileName, ".vmdk")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index c3fa2dc..5379876 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -313,9 +313,8 @@ vmwareStopVM(struct vmware_driver *driver,
vmwareSetSentinal(cmd, vmwareDriverTypeToString(driver->type));
vmwareSetSentinal(cmd, ((vmwareDomainPtr) vm->privateData)->vmxPath);
- if (virRun(cmd, NULL) < 0) {
+ if (virRun(cmd, NULL) < 0)
return -1;
- }
vm->def->id = -1;
virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
@@ -345,9 +344,8 @@ vmwareStartVM(struct vmware_driver *driver, virDomainObjPtr vm)
else
vmwareSetSentinal(cmd, NULL);
- if (virRun(cmd, NULL) < 0) {
+ if (virRun(cmd, NULL) < 0)
return -1;
- }
if ((vm->def->id = vmwareExtractPid(vmxPath)) < 0) {
vmwareStopVM(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 58e796d..e1e10a2 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -107,9 +107,8 @@ read_bd_stat(int device, int domid, const char *str)
VIR_FREE(path);
- if (r >= 0) {
+ if (r >= 0)
return r;
- }
}
return -1;
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 5f7c98f..7334142 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2550,15 +2550,13 @@ xenUnifiedNodeDeviceAssignedDomainId(virNodeDevicePtr dev)
/* Get active domains */
numdomains = xenUnifiedConnectNumOfDomains(conn);
- if (numdomains < 0) {
+ if (numdomains < 0)
return ret;
- }
if (numdomains > 0) {
if (VIR_ALLOC_N(ids, numdomains) < 0)
goto out;
- if ((numdomains = xenUnifiedConnectListDomains(conn, &ids[0], numdomains))
< 0) {
+ if ((numdomains = xenUnifiedConnectListDomains(conn, &ids[0], numdomains))
< 0)
goto out;
- }
}
/* Get pci bdf */
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 4be8891..5dcaf7f 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2258,9 +2258,8 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int
*longmode)
if (STREQLEN((const char *)®s.r_ebx, "AuthcAMDenti", 12)) {
if (pread(fd, ®s, sizeof(regs), 0x80000001) == sizeof(regs)) {
/* Read secure virtual machine bit (bit 2 of ECX feature ID) */
- if ((regs.r_ecx >> 2) & 1) {
+ if ((regs.r_ecx >> 2) & 1)
*hvm = "svm";
- }
if ((regs.r_edx >> 6) & 1)
*pae = 1;
}
@@ -2447,9 +2446,8 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
/* Search for existing matching (model,hvm) tuple */
for (i = 0; i < nr_guest_archs; i++) {
if (guest_archs[i].arch == arch &&
- guest_archs[i].hvm == hvm) {
+ guest_archs[i].hvm == hvm)
break;
- }
}
/* Too many arch flavours - highly unlikely ! */
@@ -2571,9 +2569,8 @@ xenHypervisorDomainGetOSType(virConnectPtr conn,
/* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/
if (hv_versions.hypervisor < 2 ||
- hv_versions.dom_interface < 4) {
+ hv_versions.dom_interface < 4)
return xenDaemonDomainGetOSType(conn, def);
- }
XEN_GETDOMAININFO_CLEAR(dominfo);
@@ -2935,9 +2932,8 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
else
op_sys.u.availheap.node = cell;
ret = xenHypervisorDoV2Sys(priv->handle, &op_sys);
- if (ret < 0) {
+ if (ret < 0)
return -1;
- }
if (hv_versions.sys_interface >= 5)
freeMems[i] = op_sys.u.availheap5.avail_bytes;
else
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index cd1e2df..a6f4116 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -417,9 +417,8 @@ xenInotifyOpen(virConnectPtr conn,
VIR_DEBUG("Registering with event loop");
/* Add the handle for monitoring */
if ((priv->inotifyWatch = virEventAddHandle(priv->inotifyFD,
VIR_EVENT_HANDLE_READABLE,
- xenInotifyEvent, conn, NULL)) < 0) {
+ xenInotifyEvent, conn, NULL)) < 0)
VIR_DEBUG("Failed to add inotify handle, disabling events");
- }
return 0;
}
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index f1322c4..950196c 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -147,14 +147,12 @@ wr_sync(int fd, void *buffer, size_t size, int do_read)
}
/* recoverable error, retry */
- if ((len == -1) && ((errno == EAGAIN) || (errno == EINTR))) {
+ if ((len == -1) && ((errno == EAGAIN) || (errno == EINTR)))
continue;
- }
/* eof */
- if (len == 0) {
+ if (len == 0)
break;
- }
/* unrecoverable error */
if (len == -1) {
@@ -1759,9 +1757,8 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
struct sexpr *root;
root = sexpr_get(conn, "/xend/node/");
- if (root == NULL) {
+ if (root == NULL)
return -1;
- }
ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
@@ -2039,9 +2036,8 @@ xenDaemonDomainGetVcpus(virConnectPtr conn,
if (t->u.s.car->kind == SEXPR_VALUE
&& virStrToLong_i(t->u.s.car->u.value,
NULL, 10, &cpu) == 0
&& cpu >= 0
- && (VIR_CPU_MAPLEN(cpu+1) <= maplen)) {
+ && (VIR_CPU_MAPLEN(cpu+1) <= maplen))
VIR_USE_CPU(cpumap, cpu);
- }
break;
}
}
@@ -2078,9 +2074,8 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
names = xenDaemonListDomainsOld(conn);
tmp = names;
- if (names == NULL) {
+ if (names == NULL)
return NULL;
- }
while (*tmp != NULL) {
id = xenDaemonDomainLookupByName_ids(conn, *tmp, &ident[0]);
if (id >= 0) {
@@ -2160,9 +2155,8 @@ xenDaemonCreateXML(virConnectPtr conn, virDomainDefPtr def)
ret = xenDaemonDomainCreateXML(conn, sexpr);
VIR_FREE(sexpr);
- if (ret != 0) {
+ if (ret != 0)
goto error;
- }
/* This comes before wait_for_devices, to ensure that latter
cleanup will destroy the domain upon failure */
@@ -2562,9 +2556,8 @@ xenDaemonDomainGetAutostart(virConnectPtr conn,
*autostart = 0;
tmp = sexpr_node(root, "domain/on_xend_start");
- if (tmp && STREQ(tmp, "start")) {
+ if (tmp && STREQ(tmp, "start"))
*autostart = 1;
- }
sexpr_free(root);
return 0;
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 30985d8..966bbf9 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -121,9 +121,8 @@ xenXMConfigReaper(const void *payload,
if (entry->refreshedAt != args->now) {
const char *olddomname = entry->def->name;
char *nameowner = (char *)virHashLookup(args->priv->nameConfigMap,
olddomname);
- if (nameowner && STREQ(nameowner, key)) {
+ if (nameowner && STREQ(nameowner, key))
virHashRemoveEntry(args->priv->nameConfigMap, olddomname);
- }
return 1;
}
return 0;
@@ -231,9 +230,8 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
/* If we currently own the name, then release it and
re-acquire it later - just in case it was renamed */
nameowner = (char *)virHashLookup(priv->nameConfigMap,
entry->def->name);
- if (nameowner && STREQ(nameowner, filename)) {
+ if (nameowner && STREQ(nameowner, filename))
virHashRemoveEntry(priv->nameConfigMap, entry->def->name);
- }
/* Clear existing config entry which needs refresh */
virDomainDefFree(entry->def);
@@ -372,9 +370,8 @@ xenXMConfigCacheRefresh(virConnectPtr conn)
/* If we already have a matching entry and it is not
modified, then carry on to next one*/
- if (xenXMConfigCacheAddFile(conn, path) < 0) {
- /* Ignoring errors, since a lot of stuff goes wrong in /etc/xen */
- }
+ xenXMConfigCacheAddFile(conn, path);
+ /* Ignoring errors, since a lot of stuff goes wrong in /etc/xen */
VIR_FREE(path);
}
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index ed4f7e8..0a228f8 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -136,9 +136,8 @@ xenapiConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (conn->uri == NULL || conn->uri->scheme == NULL ||
- STRCASENEQ(conn->uri->scheme, "XenAPI")) {
+ STRCASENEQ(conn->uri->scheme, "XenAPI"))
return VIR_DRV_OPEN_DECLINED;
- }
if (conn->uri->server == NULL) {
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
@@ -1493,16 +1492,13 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
}
defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
enum xen_on_normal_exit action;
- if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
+ if (xen_vm_get_actions_after_shutdown(session, &action, vm))
defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
- }
- if (xen_vm_get_actions_after_reboot(session, &action, vm)) {
+ if (xen_vm_get_actions_after_reboot(session, &action, vm))
defPtr->onReboot = xenapiNormalExitEnum2virDomainLifecycle(action);
- }
enum xen_on_crash_behaviour crash;
- if (xen_vm_get_actions_after_crash(session, &crash, vm)) {
+ if (xen_vm_get_actions_after_crash(session, &crash, vm))
defPtr->onCrash = xenapiCrashExitEnum2virDomainLifecycle(action);
- }
xen_vm_get_platform(session, &result, vm);
if (result != NULL) {
size_t i;
@@ -2060,9 +2056,8 @@ call_func(const void *data, size_t len, void *user_handle,
fflush(stdout);
#endif
CURL *curl = curl_easy_init();
- if (!curl) {
+ if (!curl)
return -1;
- }
xen_comms comms = {
.func = result_func,
.handle = result_handle
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index c71dd15..3f7f00e 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -67,15 +67,13 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char
*username,
memset(&cred, 0, sizeof(virConnectCredential));
if (virAsprintf(&prompt, "Enter %s password for %s", username,
- hostname) < 0) {
+ hostname) < 0)
return NULL;
- }
for (ncred = 0; ncred < auth->ncredtype; ncred++) {
if (auth->credtype[ncred] != VIR_CRED_PASSPHRASE &&
- auth->credtype[ncred] != VIR_CRED_NOECHOPROMPT) {
+ auth->credtype[ncred] != VIR_CRED_NOECHOPROMPT)
continue;
- }
cred.type = auth->credtype[ncred];
cred.prompt = prompt;
@@ -84,9 +82,8 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char
*username,
cred.result = NULL;
cred.resultlen = 0;
- if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
+ if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0)
VIR_FREE(cred.result);
- }
break;
}
@@ -105,9 +102,8 @@ xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int
*noVerify)
for (i = 0; i < uri->paramsCount; i++) {
virURIParamPtr queryParam = &uri->params[i];
if (STRCASEEQ(queryParam->name, "no_verify")) {
- if (noVerify == NULL) {
+ if (noVerify == NULL)
continue;
- }
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
@@ -282,9 +278,8 @@ mapDomainPinVcpu(unsigned char *cpumap, int maplen)
size_t i, j;
for (i = 0; i < maplen; i++) {
for (j = 0; j < 8; j++) {
- if (cpumap[i] & (1 << j)) {
+ if (cpumap[i] & (1 << j))
virBufferAsprintf(&buf, "%zu,", (8*i)+j);
- }
}
}
if (virBufferCheckError(&buf) < 0)
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 32954f3..113b32f 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -593,9 +593,8 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def, int
xendConfigVersion)
goto cleanup;
if (listenAddr &&
virDomainGraphicsListenSetAddress(graphics, 0, listenAddr,
- -1, true) < 0) {
+ -1, true) < 0)
goto cleanup;
- }
VIR_FREE(listenAddr);
if (xenConfigCopyStringOpt(conf, "vncpasswd",
&graphics->data.vnc.auth.passwd) < 0)
@@ -729,9 +728,8 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def)
!(chr = xenParseSxprChar(str, NULL)))
goto cleanup;
if (chr) {
- if (VIR_ALLOC_N(def->parallels, 1) < 0) {
+ if (VIR_ALLOC_N(def->parallels, 1) < 0)
goto cleanup;
- }
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
chr->target.port = 0;
@@ -762,9 +760,8 @@ xenParseCharDev(virConfPtr conf, virDomainDefPtr def)
goto cleanup;
chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
chr->target.port = portnum;
- if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0) {
+ if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) < 0)
goto cleanup;
- }
value = value->next;
}
@@ -1632,9 +1629,8 @@ xenFormatCPUAllocation(virConfPtr conf, virDomainDefPtr def)
goto cleanup;
if ((def->cpumask != NULL) &&
- ((cpus = virBitmapFormat(def->cpumask)) == NULL)) {
+ ((cpus = virBitmapFormat(def->cpumask)) == NULL))
goto cleanup;
- }
if (cpus &&
xenXMConfigSetString(conf, "cpus", cpus) < 0)
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 6623ea8..e8a22f9 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -130,15 +130,13 @@ xenParseSxprOS(const struct sexpr *node,
/* If HVM kenrel == loader, then old xend, so kill off kernel */
if (hvm &&
def->os.kernel &&
- STREQ(def->os.kernel, def->os.loader->path)) {
+ STREQ(def->os.kernel, def->os.loader->path))
VIR_FREE(def->os.kernel);
- }
/* Drop kernel argument that has no value */
if (hvm &&
def->os.kernel && *def->os.kernel == '\0' &&
- def->os.loader) {
+ def->os.loader)
VIR_FREE(def->os.kernel);
- }
if (!def->os.kernel &&
hvm) {
@@ -1959,16 +1957,14 @@ xenFormatSxprNet(virConnectPtr conn,
if (def->model != NULL && STREQ(def->model, "netfront"))
{
virBufferAddLit(buf, "(type netfront)");
} else {
- if (def->model != NULL) {
+ if (def->model != NULL)
virBufferEscapeSexpr(buf, "(model '%s')",
def->model);
- }
/*
* apparently (type ioemu) breaks paravirt drivers on HVM so skip
* this from XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
*/
- if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU) {
+ if (xendConfigVersion <= XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU)
virBufferAddLit(buf, "(type ioemu)");
- }
}
}
diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index 1e57e24..8d35f62 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -337,9 +337,8 @@ xenFormatXMDisks(virConfPtr conf, virDomainDefPtr def, int
xendConfigVersion)
if (xendConfigVersion == XEND_CONFIG_VERSION_3_0_2 &&
def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
def->disks[i]->dst &&
- STREQ(def->disks[i]->dst, "hdc")) {
+ STREQ(def->disks[i]->dst, "hdc"))
continue;
- }
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
continue;
--
2.1.3