maint: use hanging curly braces

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@redhat.com>
This commit is contained in:
Eric Blake 2014-09-03 16:24:43 -06:00
parent 143cfa8ee8
commit 625e04a86e
10 changed files with 17 additions and 31 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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++;

View File

@ -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;