mirror of https://gitee.com/openkylin/libvirt.git
Remove unnecessary curly brackets in rest of src/[a-n]*/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
677ddc828a
commit
138c2aee01
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1154,9 +1154,8 @@ bhyveStateInitialize(bool priveleged,
|
|||
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -845,9 +845,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 +951,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 +1100,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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1160,9 +1160,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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1586,9 +1586,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;
|
||||
|
@ -1972,9 +1971,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);
|
||||
|
@ -1985,9 +1983,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1340,9 +1340,8 @@ networkStartDhcpDaemon(virNetworkObjPtr network)
|
|||
goto cleanup;
|
||||
|
||||
ret = virCommandRun(cmd, NULL);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* There really is no race here - when dnsmasq daemonizes, its
|
||||
|
@ -2016,9 +2015,8 @@ networkStartNetworkVirtual(virNetworkObjPtr network)
|
|||
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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -1139,15 +1138,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:
|
||||
|
|
|
@ -797,9 +797,8 @@ virNWFilterLearnInit(void)
|
|||
threadsTerminate = false;
|
||||
|
||||
pendingLearnReq = virHashCreate(0, freeLearnReqEntry);
|
||||
if (!pendingLearnReq) {
|
||||
if (!pendingLearnReq)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ifaceLockMap = virHashCreate(0, virHashValueFree);
|
||||
if (!ifaceLockMap) {
|
||||
|
|
Loading…
Reference in New Issue