Our style overwhelmingly uses hanging braces (the open brace
hangs at the end of the compound condition, rather than on
its own line), with the primary exception of the top level function
body. Fix the few remaining outliers, before adding a syntax
check in a later patch.
* src/interface/interface_backend_netcf.c (netcfStateReload)
(netcfInterfaceClose, netcf_to_vir_err): Correct use of { in
compound statement.
* src/conf/domain_conf.c (virDomainHostdevDefFormatSubsys)
(virDomainHostdevDefFormatCaps): Likewise.
* src/network/bridge_driver.c (networkAllocateActualDevice):
Likewise.
* src/util/virfile.c (virBuildPathInternal): Likewise.
* src/util/virnetdev.c (virNetDevGetVirtualFunctions): Likewise.
* src/util/virnetdevmacvlan.c
(virNetDevMacVLanVPortProfileCallback): Likewise.
* src/util/virtypedparam.c (virTypedParameterAssign): Likewise.
* src/util/virutil.c (virGetWin32DirectoryRoot)
(virFileWaitForDevices): Likewise.
* src/vbox/vbox_common.c (vboxDumpNetwork): Likewise.
* tests/seclabeltest.c (main): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 6 ++----
src/interface/interface_backend_netcf.c | 9 +++------
src/network/bridge_driver.c | 3 +--
src/util/virfile.c | 3 +--
src/util/virnetdev.c | 3 +--
src/util/virnetdevmacvlan.c | 5 ++---
src/util/virtypedparam.c | 3 +--
src/util/virutil.c | 6 ++----
src/vbox/vbox_common.c | 4 ++--
tests/seclabeltest.c | 6 ++----
10 files changed, 17 insertions(+), 31 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 508de21..efc2eb0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16068,8 +16068,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- switch (def->source.subsys.type)
- {
+ switch (def->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
if (usbsrc->vendor) {
virBufferAsprintf(buf, "<vendor id='0x%.4x'/>\n",
usbsrc->vendor);
@@ -16146,8 +16145,7 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf,
virBufferAddLit(buf, "<source>\n");
virBufferAdjustIndent(buf, 2);
- switch (def->source.caps.type)
- {
+ switch (def->source.caps.type) {
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE:
virBufferEscapeString(buf, "<block>%s</block>\n",
def->source.caps.u.storage.block);
diff --git a/src/interface/interface_backend_netcf.c
b/src/interface/interface_backend_netcf.c
index 1b9ace5..c55a080 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -126,8 +126,7 @@ netcfStateReload(void)
virObjectLock(driverState);
ncf_close(driverState->netcf);
- if (ncf_init(&driverState->netcf, NULL) != 0)
- {
+ if (ncf_init(&driverState->netcf, NULL) != 0) {
/* this isn't a good situation, because we can't shut down the
* driver as there may still be connections to it. If we set
* the netcf handle to NULL, any subsequent calls to netcf
@@ -178,8 +177,7 @@ netcfGetMinimalDefForDevice(struct netcf_if *iface)
static int netcf_to_vir_err(int netcf_errcode)
{
- switch (netcf_errcode)
- {
+ switch (netcf_errcode) {
case NETCF_NOERROR:
/* no error, everything ok */
return VIR_ERR_OK;
@@ -285,8 +283,7 @@ static int
netcfInterfaceClose(virConnectPtr conn)
{
- if (conn->interfacePrivateData != NULL)
- {
+ if (conn->interfacePrivateData != NULL) {
virObjectUnref(conn->interfacePrivateData);
conn->interfacePrivateData = NULL;
}
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 2886866..0bc4a4d 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3871,8 +3871,7 @@ networkAllocateActualDevice(virDomainDefPtr dom,
iface->data.network.actual->data.hostdev.def.source.subsys.type =
dev->type;
iface->data.network.actual->data.hostdev.def.source.subsys.u.pci.addr =
dev->device.pci;
- switch (netdef->forward.driverName)
- {
+ switch (netdef->forward.driverName) {
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
break;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index b6f5e3f..cfb6cc1 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1172,8 +1172,7 @@ virBuildPathInternal(char **path, ...)
path_component = va_arg(ap, char *);
virBufferAdd(&buf, path_component, -1);
- while ((path_component = va_arg(ap, char *)) != NULL)
- {
+ while ((path_component = va_arg(ap, char *)) != NULL) {
virBufferAddChar(&buf, '/');
virBufferAdd(&buf, path_component, -1);
}
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index cf526ec..58bf27c 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1132,8 +1132,7 @@ virNetDevGetVirtualFunctions(const char *pfname,
if (VIR_ALLOC_N(*vfname, *n_vfname) < 0)
goto cleanup;
- for (i = 0; i < *n_vfname; i++)
- {
+ for (i = 0; i < *n_vfname; i++) {
if (virPCIGetAddrString((*virt_fns)[i]->domain,
(*virt_fns)[i]->bus,
(*virt_fns)[i]->slot,
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 50aabc5..c83341c 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
* Copyright (C) 2010-2012 IBM Corporation
*
* This library is free software; you can redistribute it and/or
@@ -583,8 +583,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
VIR_DEBUG("IFLA_VF_MAC = %2x:%2x:%2x:%2x:%2x:%2x",
m[0], m[1], m[2], m[3], m[4], m[5]);
- if (virMacAddrCmpRaw(&calld->macaddress, mac->mac))
- {
+ if (virMacAddrCmpRaw(&calld->macaddress, mac->mac)) {
/* Repeat the same check for a broadcast mac */
size_t i;
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index 668a7df..de2d447 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -195,8 +195,7 @@ virTypedParameterAssign(virTypedParameterPtr param, const char *name,
goto cleanup;
}
param->type = type;
- switch (type)
- {
+ switch (type) {
case VIR_TYPED_PARAM_INT:
param->value.i = va_arg(ap, int);
break;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 2edbec5..04113bb 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1153,8 +1153,7 @@ virGetWin32DirectoryRoot(char **path)
*path = NULL;
- if (GetWindowsDirectory(windowsdir, ARRAY_CARDINALITY(windowsdir)))
- {
+ if (GetWindowsDirectory(windowsdir, ARRAY_CARDINALITY(windowsdir))) {
const char *tmp;
/* Usually X:\Windows, but in terminal server environments
* might be an UNC path, AFAIK.
@@ -1499,8 +1498,7 @@ void virFileWaitForDevices(void)
* If this fails for any reason, we still have the backup of polling for
* 5 seconds for device nodes.
*/
- if (virRun(settleprog, &exitstatus) < 0)
- {}
+ ignore_value(virRun(settleprog, &exitstatus));
}
#else
void virFileWaitForDevices(void)
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index eecfff6..b9858ee 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -3576,8 +3576,8 @@ vboxDumpNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine
*machine, PR
MACAddress[8], MACAddress[9], MACAddress[10], MACAddress[11]);
/* XXX some real error handling here some day ... */
- if (virMacAddrParse(macaddr, &def->nets[netAdpIncCnt]->mac)
< 0)
- {}
+ ignore_value(virMacAddrParse(macaddr,
+ &def->nets[netAdpIncCnt]->mac));
netAdpIncCnt++;
diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c
index cd34b6b..51765c9 100644
--- a/tests/seclabeltest.c
+++ b/tests/seclabeltest.c
@@ -24,16 +24,14 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
}
model = virSecurityManagerGetModel(mgr);
- if (!model)
- {
+ if (!model) {
fprintf(stderr, "Failed to copy secModel model: %s",
strerror(errno));
return EXIT_FAILURE;
}
doi = virSecurityManagerGetDOI(mgr);
- if (!doi)
- {
+ if (!doi) {
fprintf(stderr, "Failed to copy secModel DOI: %s",
strerror(errno));
return EXIT_FAILURE;
--
1.9.3