[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 12/15] Remove unneeded curly brackets around oneline code blocks in src/[n-r]*/



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 redhat com>
---
 src/network/bridge_driver.c               | 53 ++++++++++---------------------
 src/network/bridge_driver_linux.c         |  9 ++----
 src/network/leaseshelper.c                |  3 +-
 src/nodeinfo.c                            |  3 +-
 src/nwfilter/nwfilter_dhcpsnoop.c         |  6 ++--
 src/nwfilter/nwfilter_ebiptables_driver.c | 12 +++----
 src/nwfilter/nwfilter_gentech_driver.c    | 12 +++----
 src/nwfilter/nwfilter_learnipaddr.c       |  3 +-
 src/openvz/openvz_conf.c                  |  3 +-
 src/openvz/openvz_driver.c                | 33 +++++++------------
 src/parallels/parallels_driver.c          |  6 ++--
 src/phyp/phyp_driver.c                    | 21 ++++--------
 src/remote/remote_driver.c                | 33 +++++++------------
 src/rpc/virnetclient.c                    |  9 ++----
 src/rpc/virnetserver.c                    |  3 +-
 src/rpc/virnetserverclient.c              |  3 +-
 src/rpc/virnetserverservice.c             |  3 +-
 17 files changed, 72 insertions(+), 143 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 11e86e0..e84c2c0 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -276,9 +276,8 @@ networkRemoveInactive(virNetworkDriverStatePtr driver,

     /* remove the (possibly) existing dnsmasq and radvd files */
     if (!(dctx = dnsmasqContextNew(def->name,
-                                   driverState->dnsmasqStateDir))) {
+                                   driverState->dnsmasqStateDir)))
         goto cleanup;
-    }

     if (!(leasefile = networkDnsmasqLeaseFileName(def->name)))
         goto cleanup;
@@ -443,11 +442,8 @@ networkAutostartConfigs(virNetworkDriverStatePtr driver)
     for (i = 0; i < driver->networks.count; i++) {
         virNetworkObjLock(driver->networks.objs[i]);
         if (driver->networks.objs[i]->autostart &&
-            !virNetworkObjIsActive(driver->networks.objs[i])) {
-            if (networkStartNetwork(driver, driver->networks.objs[i]) < 0) {
-                /* failed to start but already logged */
-            }
-        }
+            !virNetworkObjIsActive(driver->networks.objs[i]))
+            networkStartNetwork(driver, driver->networks.objs[i]);
         virNetworkObjUnlock(driver->networks.objs[i]);
     }
 }
@@ -615,9 +611,8 @@ networkStateInitialize(bool privileged,
             (virAsprintf(&driverState->dnsmasqStateDir,
                          "%s/dnsmasq/lib", rundir) < 0) ||
             (virAsprintf(&driverState->radvdStateDir,
-                         "%s/radvd/lib", rundir) < 0)) {
+                         "%s/radvd/lib", rundir) < 0))
             goto error;
-        }
     }

     if (virFileMakePath(driverState->stateDir) < 0) {
@@ -1350,9 +1345,8 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
         goto cleanup;

     ret = virCommandRun(cmd, NULL);
-    if (ret < 0) {
+    if (ret < 0)
         goto cleanup;
-    }

     /*
      * There really is no race here - when dnsmasq daemonizes, its
@@ -1401,9 +1395,8 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver,

     VIR_INFO("Refreshing dnsmasq for network %s", network->def->bridge);
     if (!(dctx = dnsmasqContextNew(network->def->name,
-                                   driverState->dnsmasqStateDir))) {
+                                   driverState->dnsmasqStateDir)))
         goto cleanup;
-    }

     /* Look for first IPv4 address that has dhcp defined.
      * We only support dhcp-host config on one IPv4 subnetwork
@@ -1788,9 +1781,7 @@ networkReloadFirewallRules(virNetworkDriverStatePtr driver)
              * need to have iptables rules reloaded.
              */
             networkRemoveFirewallRules(network->def);
-            if (networkAddFirewallRules(network->def) < 0) {
-                /* failed to add but already logged */
-            }
+            networkAddFirewallRules(network->def);
         }
         virNetworkObjUnlock(network);
     }
@@ -1952,9 +1943,8 @@ networkAddRouteToBridge(virNetworkObjPtr network,
         metric = 1;

     if (virNetDevAddRoute(network->def->bridge, &routedef->address,
-                          prefix, &routedef->gateway, metric) < 0) {
+                          prefix, &routedef->gateway, metric) < 0)
         return -1;
-    }
     return 0;
 }

@@ -2032,9 +2022,8 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
             v6present = true;

         /* Add the IP address/netmask to the bridge */
-        if (networkAddAddrToBridge(network, ipdef) < 0) {
+        if (networkAddAddrToBridge(network, ipdef) < 0)
             goto err2;
-        }
     }

     /* Bring up the bridge interface */
@@ -2852,9 +2841,8 @@ networkValidate(virNetworkDriverStatePtr driver,
             if (def->portGroups[i].virtPortProfile) {
                 if (def->forward.type != VIR_NETWORK_FORWARD_BRIDGE ||
                     def->portGroups[i].virtPortProfile->virtPortType
-                    != VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
+                    != VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
                     badVlanUse = true;
-                }
             } else if (!vlanAllowed) {
                 /* virtualport taken from base network definition */
                 badVlanUse = true;
@@ -3156,9 +3144,8 @@ networkUpdate(virNetworkPtr net,
     if (flags & VIR_NETWORK_UPDATE_AFFECT_CONFIG) {
         /* save updated persistent config to disk */
         if (virNetworkSaveConfig(driver->networkConfigDir,
-                                 virNetworkObjGetPersistentDef(network)) < 0) {
+                                 virNetworkObjGetPersistentDef(network)) < 0)
             goto cleanup;
-        }
     }

     if (isActive && (flags & VIR_NETWORK_UPDATE_AFFECT_LIVE)) {
@@ -3196,9 +3183,8 @@ networkUpdate(virNetworkPtr net,

             if ((newDhcpActive != oldDhcpActive &&
                  networkRestartDhcpDaemon(driver, network) < 0) ||
-                networkRefreshDhcpDaemon(driver, network) < 0) {
+                networkRefreshDhcpDaemon(driver, network) < 0)
                 goto cleanup;
-            }

         } else if (section == VIR_NETWORK_SECTION_DNS_HOST ||
                    section == VIR_NETWORK_SECTION_DNS_TXT ||
@@ -3222,9 +3208,8 @@ networkUpdate(virNetworkPtr net,

         /* save current network state to disk */
         if ((ret = virNetworkSaveStatus(driverState->stateDir,
-                                        network)) < 0) {
+                                        network)) < 0)
             goto cleanup;
-        }
     }
     ret = 0;
  cleanup:
@@ -3836,9 +3821,8 @@ networkAllocateActualDevice(virDomainDefPtr dom,
                                         iface->virtPortProfile,
                                         netdef->virtPortProfile,
                                         portgroup
-                                        ? portgroup->virtPortProfile : NULL) < 0) {
+                                        ? portgroup->virtPortProfile : NULL) < 0)
             goto error;
-        }
         virtport = iface->data.network.actual->virtPortProfile;
         if (virtport) {
             /* only type='openvswitch' is allowed for bridges */
@@ -3909,9 +3893,8 @@ networkAllocateActualDevice(virDomainDefPtr dom,
                                         iface->virtPortProfile,
                                         netdef->virtPortProfile,
                                         portgroup
-                                        ? portgroup->virtPortProfile : NULL) < 0) {
+                                        ? portgroup->virtPortProfile : NULL) < 0)
             goto error;
-        }
         virtport = iface->data.network.actual->virtPortProfile;
         if (virtport) {
             /* make sure type is supported for hostdev connections */
@@ -3960,9 +3943,8 @@ networkAllocateActualDevice(virDomainDefPtr dom,
                                         iface->virtPortProfile,
                                         netdef->virtPortProfile,
                                         portgroup
-                                        ? portgroup->virtPortProfile : NULL) < 0) {
+                                        ? portgroup->virtPortProfile : NULL) < 0)
             goto error;
-        }
         virtport = iface->data.network.actual->virtPortProfile;
         if (virtport) {
             /* make sure type is supported for macvtap connections */
@@ -4544,9 +4526,8 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
     }

     if (!(addrptr &&
-          (*netaddr = virSocketAddrFormat(addrptr)))) {
+          (*netaddr = virSocketAddrFormat(addrptr))))
         goto error;
-    }

     ret = 0;
  cleanup:
diff --git a/src/network/bridge_driver_linux.c b/src/network/bridge_driver_linux.c
index 6b32838..3fcc7f2 100644
--- a/src/network/bridge_driver_linux.c
+++ b/src/network/bridge_driver_linux.c
@@ -74,9 +74,8 @@ int networkCheckRouteCollision(virNetworkDefPtr def)

         /* NUL-terminate the line, so sscanf doesn't go beyond a newline.  */
         char *nl = strchr(cur, '\n');
-        if (nl) {
+        if (nl)
             *nl++ = '\0';
-        }

         num = sscanf(cur, "%16s %127s %*s %*s %*s %*s %*s %127s",
                      iface, dest, mask);
@@ -460,9 +459,8 @@ networkAddGeneralIPv6FirewallRules(virFirewallPtr fw,
 {

     if (!virNetworkDefGetIpByIndex(def, AF_INET6, 0) &&
-        !def->ipv6nogw) {
+        !def->ipv6nogw)
         return;
-    }

     /* Catch all rules to block forwarding to/from bridges */
     iptablesAddForwardRejectOut(fw, VIR_FIREWALL_LAYER_IPV6, def->bridge);
@@ -484,9 +482,8 @@ networkRemoveGeneralIPv6FirewallRules(virFirewallPtr fw,
                                       virNetworkDefPtr def)
 {
     if (!virNetworkDefGetIpByIndex(def, AF_INET6, 0) &&
-        !def->ipv6nogw) {
+        !def->ipv6nogw)
         return;
-    }

     if (virNetworkDefGetIpByIndex(def, AF_INET6, 0)) {
         iptablesRemoveUdpInput(fw, VIR_FIREWALL_LAYER_IPV6, def->bridge, 547);
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 5b3c9c3..eb216cc 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -209,9 +209,8 @@ main(int argc, char **argv)
     /* Read entire contents */
     if ((custom_lease_file_len = virFileReadAll(custom_lease_file,
                                                 VIR_NETWORK_DHCP_LEASE_FILE_SIZE_MAX,
-                                                &lease_entries)) < 0) {
+                                                &lease_entries)) < 0)
         goto cleanup;
-    }

     if (action == VIR_LEASE_ACTION_ADD ||
         action == VIR_LEASE_ACTION_OLD ||
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 2e2fffa..24a9214 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -821,9 +821,8 @@ linuxNodeGetCPUStats(FILE *procstat,
                        "%*s %llu %llu %llu %llu %llu" // user ~ iowait
                        "%llu %llu %llu %llu %llu",    // irq  ~ guest_nice
                        &usr, &ni, &sys, &idle, &iowait,
-                       &irq, &softirq, &steal, &guest, &guest_nice) < 4) {
+                       &irq, &softirq, &steal, &guest, &guest_nice) < 4)
                 continue;
-            }

             if (virNodeCPUStatsAssign(&params[0], VIR_NODE_CPU_STATS_KERNEL,
                                       (sys + irq + softirq) * TICK_TO_NSEC) < 0)
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index a2f58ba..5b4965d 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -315,9 +315,8 @@ virNWFilterSnoopActivate(virNWFilterSnoopReqPtr req)

     virNWFilterSnoopActiveLock();

-    if (virHashAddEntry(virNWFilterSnoopState.active, key, (void *)0x1) < 0) {
+    if (virHashAddEntry(virNWFilterSnoopState.active, key, (void *)0x1) < 0)
         VIR_FREE(key);
-    }

     virNWFilterSnoopActiveUnlock();

@@ -1420,9 +1419,8 @@ virNWFilterDHCPSnoopThread(void *req0)
     while (!error) {
         if (virNWFilterSnoopAdjustPoll(pcapConf,
                                        ARRAY_CARDINALITY(pcapConf),
-                                       fds, &pollTo) < 0) {
+                                       fds, &pollTo) < 0)
             break;
-        }

         /* cap pollTo so we don't hold up the join for too long */
         if (pollTo < 0 || pollTo > SNOOP_POLL_MAX_TIMEOUT_MS)
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 2b89439..377b59b 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3084,14 +3084,12 @@ virNWFilterRuleInstSort(const void *a, const void *b)
     /* ensure root chain commands appear before all others since
        we will need them to create the child chains */
     if (root_a) {
-        if (root_b) {
+        if (root_b)
             goto normal;
-        }
         return -1; /* a before b */
     }
-    if (root_b) {
+    if (root_b)
         return 1; /* b before a */
-    }
  normal:
     /* priorities are limited to range [-1000, 1000] */
     return insta->priority - instb->priority;
@@ -3165,9 +3163,8 @@ ebtablesGetProtoIdxByFiltername(const char *filtername)
     enum l3_proto_idx idx;

     for (idx = 0; idx < L3_PROTO_LAST_IDX; idx++) {
-        if (STRPREFIX(filtername, l3_protocols[idx].val)) {
+        if (STRPREFIX(filtername, l3_protocols[idx].val))
             return idx;
-        }
     }

     return -1;
@@ -3303,9 +3300,8 @@ ebtablesGetSubChainInsts(virHashTablePtr chains,
  cleanup:
     VIR_FREE(filter_names);
     if (ret < 0) {
-        for (i = 0; i < *ninsts; i++) {
+        for (i = 0; i < *ninsts; i++)
             VIR_FREE(*insts[i]);
-        }
         VIR_FREE(*insts);
         *ninsts = 0;
     }
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 79fc422..aaca77d 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -567,9 +567,8 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,

                 switch (useNewFilter) {
                 case INSTANTIATE_FOLLOW_NEWFILTER:
-                    if (obj->newDef) {
+                    if (obj->newDef)
                         next_filter = obj->newDef;
-                    }
                     break;
                 case INSTANTIATE_ALWAYS:
                     break;
@@ -705,9 +704,8 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
     } else if (virHashSize(missing_vars->hashTable) > 1) {
         goto err_unresolvable_vars;
     } else if (!forceWithPendingReq &&
-               virNWFilterLookupLearnReq(ifindex) != NULL) {
+               virNWFilterLookupLearnReq(ifindex) != NULL)
         goto err_exit;
-    }

     rc = virNWFilterDefToInst(driver,
                               filter,
@@ -1139,15 +1137,13 @@ virNWFilterDomainFWUpdateCB(virDomainObjPtr obj,
                     break;

                 case STEP_TEAR_NEW:
-                    if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
+                    if (!virHashLookup(cb->skipInterfaces, net->ifname))
                         ret = virNWFilterRollbackUpdateFilter(net);
-                    }
                     break;

                 case STEP_TEAR_OLD:
-                    if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
+                    if (!virHashLookup(cb->skipInterfaces, net->ifname))
                         ret = virNWFilterTearOldFilter(net);
-                    }
                     break;

                 case STEP_APPLY_CURRENT:
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 911079e..1b875c3 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -797,9 +797,8 @@ virNWFilterLearnInit(void)
     threadsTerminate = false;

     pendingLearnReq = virHashCreate(0, freeLearnReqEntry);
-    if (!pendingLearnReq) {
+    if (!pendingLearnReq)
         return -1;
-    }

     ifaceLockMap = virHashCreate(0, virHashValueFree);
     if (!ifaceLockMap) {
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 856c9f5..edf37d0 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -660,9 +660,8 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
     if (fp == NULL)
         goto error;
     temp_fd = open(temp_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-    if (temp_fd == -1) {
+    if (temp_fd == -1)
         goto error;
-    }

     while (1) {
         if (getline(&line, &line_size, fp) <= 0)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index a0346b4..6847e12 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -156,9 +156,8 @@ openvzDomainDefineCmd(virDomainDefPtr vmdef)
     virCommandAddArgList(cmd, vmdef->name, "--name", vmdef->name, NULL);

     if (vmdef->nfss == 1 &&
-        vmdef->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE) {
+        vmdef->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE)
         virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src, NULL);
-    }

     return cmd;
 }
@@ -619,9 +618,8 @@ static int openvzDomainSuspend(virDomainPtr dom)

     if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
         openvzSetProgramSentinal(prog, vm->def->name);
-        if (virRun(prog, NULL) < 0) {
+        if (virRun(prog, NULL) < 0)
             goto cleanup;
-        }
         virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
     }

@@ -658,9 +656,8 @@ static int openvzDomainResume(virDomainPtr dom)

   if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
       openvzSetProgramSentinal(prog, vm->def->name);
-      if (virRun(prog, NULL) < 0) {
+      if (virRun(prog, NULL) < 0)
           goto cleanup;
-      }
       virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
   }

@@ -1113,9 +1110,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,

     openvzSetProgramSentinal(progstart, vm->def->name);

-    if (virRun(progstart, NULL) < 0) {
+    if (virRun(progstart, NULL) < 0)
         goto cleanup;
-    }

     vm->pid = strtoI(vm->def->name);
     vm->def->id = vm->pid;
@@ -1172,9 +1168,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
     }

     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
-    }

     vm->pid = strtoI(vm->def->name);
     vm->def->id = vm->pid;
@@ -1218,9 +1213,8 @@ openvzDomainUndefineFlags(virDomainPtr dom,
         goto cleanup;

     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
-    }

     if (virDomainObjIsActive(vm)) {
         vm->persistent = 0;
@@ -1264,9 +1258,8 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
     }

     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
-    }
     ret = 0;

  cleanup:
@@ -1357,9 +1350,8 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
     str_vcpus[31] = '\0';

     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0)
         return -1;
-    }

     vm->def->maxvcpus = vm->def->vcpus = nvcpus;
     return 0;
@@ -1504,7 +1496,8 @@ static int openvzConnectClose(virConnectPtr conn)
     return 0;
 }

-static const char *openvzConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
+static const char *openvzConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED)
+{
     return "OpenVZ";
 }

@@ -1719,9 +1712,8 @@ openvzDomainSetMemoryInternal(virDomainObjPtr vm,
     snprintf(str_mem, sizeof(str_mem), "%llu", mem * 1024);

     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
-    }

     return 0;

@@ -2052,9 +2044,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
             return -1;
         }

-        if (openvzSetDiskQuota(vmdef, fs, persist) < 0) {
+        if (openvzSetDiskQuota(vmdef, fs, persist) < 0)
             return -1;
-        }
         cur->space_hard_limit = fs->space_hard_limit;
         cur->space_soft_limit = fs->space_soft_limit;
     } else {
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 808dc4a..aa0c4bd 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -167,9 +167,8 @@ parallelsBuildCapabilities(void)
     caps->host.cpu = cpu;

     if (!(data = cpuNodeData(cpu->arch))
-        || cpuDecode(cpu, data, NULL, 0, NULL) < 0) {
+        || cpuDecode(cpu, data, NULL, 0, NULL) < 0)
         goto cleanup;
-    }

  cleanup:
     cpuDataFree(data);
@@ -510,9 +509,8 @@ parallelsGetNetInfo(virDomainNetDefPtr net,

     net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP;
     if ((tmp = virJSONValueObjectGetString(value, "state")) &&
-        STREQ(tmp, "disconnected")) {
+        STREQ(tmp, "disconnected"))
         net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
-    }

     return 0;

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 09617c8..4995269 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -128,9 +128,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
         }
     }

-    if (channel == NULL) {
+    if (channel == NULL)
         goto err;
-    }

     while ((rc = libssh2_channel_exec(channel, cmd)) ==
            LIBSSH2_ERROR_EAGAIN) {
@@ -141,9 +140,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
         }
     }

-    if (rc != 0) {
+    if (rc != 0)
         goto err;
-    }

     for (;;) {
         /* loop until we block */
@@ -179,9 +177,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
         }
     }

-    if (rc == 0) {
+    if (rc == 0)
         exitcode = libssh2_channel_get_exit_status(channel);
-    }

     (*exit_status) = exitcode;
     libssh2_channel_free(channel);
@@ -690,9 +687,8 @@ phypUUIDTable_Pull(virConnectPtr conn)
         do {
             amount = sizeof(buffer);

-            if ((fileinfo.st_size - got) < amount) {
+            if ((fileinfo.st_size - got) < amount)
                 amount = fileinfo.st_size - got;
-            }

             rc = libssh2_channel_read(channel, buffer, amount);
             if (rc > 0) {
@@ -808,9 +804,8 @@ phypUUIDTable_Init(virConnectPtr conn)

  cleanup:
     if (ret < 0 && table_created) {
-        for (i = 0; i < uuid_table->nlpars; i++) {
+        for (i = 0; i < uuid_table->nlpars; i++)
             VIR_FREE(uuid_table->lpars[i]);
-        }
         VIR_FREE(uuid_table->lpars);
     }
     VIR_FREE(ids);
@@ -1695,18 +1690,16 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml)

     domain_name = escape_specialcharacters(domain->name);

-    if (domain_name == NULL) {
+    if (domain_name == NULL)
         goto cleanup;
-    }

     if (VIR_STRDUP(def->os.type, "aix") < 0)
         goto cleanup;

     dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL,
                                   VIR_DOMAIN_XML_INACTIVE);
-    if (!dev) {
+    if (!dev)
         goto cleanup;
-    }

     if (!
         (vios_name =
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index d111e10..d605616 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2191,9 +2191,8 @@ remoteDomainPinEmulator(virDomainPtr dom,
     if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_PIN_EMULATOR,
              (xdrproc_t) xdr_remote_domain_pin_emulator_args,
              (char *) &args,
-             (xdrproc_t) xdr_void, (char *) NULL) == -1) {
+             (xdrproc_t) xdr_void, (char *) NULL) == -1)
         goto done;
-    }

     rv = 0;

@@ -2352,9 +2351,8 @@ remoteDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)

     if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL,
              (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args,
-             (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) {
+             (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1)
         goto done;
-    }

     if (ret.label.label_val != NULL) {
         if (strlen(ret.label.label_val) >= sizeof(seclabel->label)) {
@@ -2392,9 +2390,8 @@ remoteDomainGetSecurityLabelList(virDomainPtr domain, virSecurityLabelPtr* secla

     if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST,
              (xdrproc_t) xdr_remote_domain_get_security_label_list_args, (char *)&args,
-             (xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret) == -1) {
+             (xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret) == -1)
         goto done;
-    }

     if (VIR_ALLOC_N(*seclabels, ret.labels.labels_len) < 0)
         goto cleanup;
@@ -2469,9 +2466,8 @@ remoteNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)

     if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL,
              (xdrproc_t) xdr_void, NULL,
-             (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) {
+             (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1)
         goto done;
-    }

     if (ret.model.model_val != NULL) {
         if (strlen(ret.model.model_val) >= sizeof(secmodel->model)) {
@@ -2655,9 +2651,8 @@ remoteDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
     memset(&ret, 0, sizeof(ret));
     if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS,
              (xdrproc_t)xdr_remote_domain_create_with_flags_args, (char *)&args,
-             (xdrproc_t)xdr_remote_domain_create_with_flags_ret, (char *)&ret) == -1) {
+             (xdrproc_t)xdr_remote_domain_create_with_flags_ret, (char *)&ret) == -1)
         goto done;
-    }

     dom->id = ret.dom.id;
     xdr_free((xdrproc_t) &xdr_remote_domain_create_with_flags_ret, (char *) &ret);
@@ -2907,9 +2902,8 @@ static int remoteDomainGetBlockIoTune(virDomainPtr domain,
              (xdrproc_t) xdr_remote_domain_get_block_io_tune_args,
                (char *) &args,
              (xdrproc_t) xdr_remote_domain_get_block_io_tune_ret,
-               (char *) &ret) == -1) {
+               (char *) &ret) == -1)
         goto done;
-    }

     /* Handle the case when the caller does not know the number of parameters
      * and is asking for the number of parameters supported
@@ -4140,9 +4134,8 @@ static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype)
     sasl_callback_t *cbs;
     size_t i;
     int n;
-    if (VIR_ALLOC_N(cbs, ncredtype+1) < 0) {
+    if (VIR_ALLOC_N(cbs, ncredtype+1) < 0)
         return NULL;
-    }

     for (i = 0, n = 0; i < ncredtype; i++) {
         int id = remoteAuthCredVir2SASL(credtype[i]);
@@ -4621,9 +4614,8 @@ remoteAuthPolkit(virConnectPtr conn, struct private_data *priv,
     memset(&ret, 0, sizeof(ret));
     if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
              (xdrproc_t) xdr_void, (char *)NULL,
-             (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
+             (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0)
         return -1; /* virError already set by call */
-    }

     VIR_DEBUG("PolicyKit-1 authentication complete");
     return 0;
@@ -4683,9 +4675,8 @@ remoteAuthPolkit(virConnectPtr conn, struct private_data *priv,
     memset(&ret, 0, sizeof(ret));
     if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT,
              (xdrproc_t) xdr_void, (char *)NULL,
-             (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) {
+             (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0)
         return -1; /* virError already set by call */
-    }

  out:
     VIR_DEBUG("PolicyKit-0 authentication complete");
@@ -7516,9 +7507,8 @@ remoteDomainCreateXMLWithFiles(virConnectPtr conn, const char *xml_desc,
                  NULL, NULL,
                  REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES,
                  (xdrproc_t)xdr_remote_domain_create_xml_with_files_args, (char *)&args,
-                 (xdrproc_t)xdr_remote_domain_create_xml_with_files_ret, (char *)&ret) == -1) {
+                 (xdrproc_t)xdr_remote_domain_create_xml_with_files_ret, (char *)&ret) == -1)
         goto done;
-    }

     rv = get_nonnull_domain(conn, ret.dom);
     xdr_free((xdrproc_t)xdr_remote_domain_create_xml_with_files_ret, (char *)&ret);
@@ -7551,9 +7541,8 @@ remoteDomainCreateWithFiles(virDomainPtr dom,
                  NULL, NULL,
                  REMOTE_PROC_DOMAIN_CREATE_WITH_FILES,
                  (xdrproc_t)xdr_remote_domain_create_with_files_args, (char *)&args,
-                 (xdrproc_t)xdr_remote_domain_create_with_files_ret, (char *)&ret) == -1) {
+                 (xdrproc_t)xdr_remote_domain_create_with_files_ret, (char *)&ret) == -1)
         goto done;
-    }

     dom->id = ret.dom.id;
     xdr_free((xdrproc_t) &xdr_remote_domain_create_with_files_ret, (char *) &ret);
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index a156fe1..8657b0e 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -160,9 +160,8 @@ static void virNetClientCallQueue(virNetClientCallPtr *head,
                                   virNetClientCallPtr call)
 {
     virNetClientCallPtr tmp = *head;
-    while (tmp && tmp->next) {
+    while (tmp && tmp->next)
         tmp = tmp->next;
-    }
     if (tmp)
         tmp->next = call;
     else
@@ -237,9 +236,8 @@ static bool virNetClientCallMatchPredicate(virNetClientCallPtr head,
 {
     virNetClientCallPtr tmp = head;
     while (tmp) {
-        if (pred(tmp, opaque)) {
+        if (pred(tmp, opaque))
             return true;
-        }
         tmp = tmp->next;
     }
     return false;
@@ -1535,9 +1533,8 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
         /* If we have existing SASL decoded data, pretend
          * the socket became readable so we consume it
          */
-        if (virNetSocketHasCachedData(client->sock)) {
+        if (virNetSocketHasCachedData(client->sock))
             fds[0].revents |= POLLIN;
-        }

         /* If wantClose flag is set, pretend there was an error on the socket
          */
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 3d3e422..47d83ba 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -1233,9 +1233,8 @@ void virNetServerClose(virNetServerPtr srv)

     virObjectLock(srv);

-    for (i = 0; i < srv->nservices; i++) {
+    for (i = 0; i < srv->nservices; i++)
         virNetServerServiceClose(srv->services[i]);
-    }

     virObjectUnlock(srv);
 }
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index c6ef84c..b2a4fdf 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -496,9 +496,8 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr objec
                            _("Missing privateData field in JSON state document"));
             goto error;
         }
-        if (!(client->privateData = privNew(client, child, privOpaque))) {
+        if (!(client->privateData = privNew(client, child, privOpaque)))
             goto error;
-        }
         client->privateDataFreeFunc = privFree;
         client->privateDataPreExecRestart = privPreExecRestart;
     }
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index 647007b..d84b6de 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -516,7 +516,6 @@ void virNetServerServiceClose(virNetServerServicePtr svc)
     if (!svc)
         return;

-    for (i = 0; i < svc->nsocks; i++) {
+    for (i = 0; i < svc->nsocks; i++)
         virNetSocketClose(svc->socks[i]);
-    }
 }
-- 
2.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]