mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-21 10:50:24 +03:00
Remove redundant two-state integers
This commit is contained in:
parent
e557766c3b
commit
85f9178160
@ -4198,7 +4198,6 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
||||
bool check_active)
|
||||
{
|
||||
int ret = -1;
|
||||
int dupVM = 0;
|
||||
virNetworkObjPtr vm = NULL;
|
||||
|
||||
/* See if a VM with matching UUID already exists */
|
||||
@ -4224,7 +4223,7 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
||||
}
|
||||
}
|
||||
|
||||
dupVM = 1;
|
||||
ret = 1;
|
||||
} else {
|
||||
/* UUID does not match, but if a name matches, refuse it */
|
||||
vm = virNetworkFindByName(doms, def->name);
|
||||
@ -4236,9 +4235,9 @@ virNetworkObjIsDuplicate(virNetworkObjListPtr doms,
|
||||
def->name, uuidstr);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
ret = dupVM;
|
||||
cleanup:
|
||||
if (vm)
|
||||
virNetworkObjUnlock(vm);
|
||||
|
@ -1922,7 +1922,6 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
||||
unsigned int check_active)
|
||||
{
|
||||
int ret = -1;
|
||||
int dupPool = 0;
|
||||
virStoragePoolObjPtr pool = NULL;
|
||||
|
||||
/* See if a Pool with matching UUID already exists */
|
||||
@ -1948,7 +1947,7 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
||||
}
|
||||
}
|
||||
|
||||
dupPool = 1;
|
||||
ret = 1;
|
||||
} else {
|
||||
/* UUID does not match, but if a name matches, refuse it */
|
||||
pool = virStoragePoolObjFindByName(pools, def->name);
|
||||
@ -1960,9 +1959,9 @@ virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
|
||||
def->name, uuidstr);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
ret = dupPool;
|
||||
cleanup:
|
||||
if (pool)
|
||||
virStoragePoolObjUnlock(pool);
|
||||
|
@ -913,7 +913,6 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
||||
uint8_t *pmtype, uint32_t *pleasetime)
|
||||
{
|
||||
int oind, olen;
|
||||
int oend;
|
||||
uint32_t nwint;
|
||||
|
||||
olen = len - sizeof(*pd);
|
||||
@ -927,8 +926,6 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
||||
|
||||
oind += sizeof(dhcp_magic);
|
||||
|
||||
oend = 0;
|
||||
|
||||
*pmtype = 0;
|
||||
*pleasetime = 0;
|
||||
|
||||
@ -953,14 +950,11 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
||||
oind++;
|
||||
continue;
|
||||
case DHCPO_END:
|
||||
oend = 1;
|
||||
break;
|
||||
return 0;
|
||||
default:
|
||||
if (olen - oind < 2)
|
||||
goto malformed;
|
||||
}
|
||||
if (oend)
|
||||
break;
|
||||
oind += pd->d_opts[oind + 1] + 2;
|
||||
}
|
||||
return 0;
|
||||
|
@ -2622,7 +2622,6 @@ static int
|
||||
qemuProcessFiltersInstantiate(virConnectPtr conn,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
int err = 0;
|
||||
int i;
|
||||
|
||||
if (!conn)
|
||||
@ -2631,14 +2630,12 @@ qemuProcessFiltersInstantiate(virConnectPtr conn,
|
||||
for (i = 0; i < def->nnets; i++) {
|
||||
virDomainNetDefPtr net = def->nets[i];
|
||||
if ((net->filter) && (net->ifname)) {
|
||||
if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0) {
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1564,7 +1564,6 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
struct ifla_vf_vlan *vf_vlan;
|
||||
struct nlattr *tb_vf_info = {NULL, };
|
||||
struct nlattr *tb_vf[IFLA_VF_MAX+1];
|
||||
int found = 0;
|
||||
int rem;
|
||||
|
||||
if (!tb[IFLA_VFINFO_LIST]) {
|
||||
@ -1588,7 +1587,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
vf_mac = RTA_DATA(tb_vf[IFLA_VF_MAC]);
|
||||
if (vf_mac && vf_mac->vf == vf) {
|
||||
virMacAddrSetRaw(mac, vf_mac->mac);
|
||||
found = 1;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1596,17 +1595,17 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
vf_vlan = RTA_DATA(tb_vf[IFLA_VF_VLAN]);
|
||||
if (vf_vlan && vf_vlan->vf == vf) {
|
||||
*vlanid = vf_vlan->vlan;
|
||||
found = 1;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
rc = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
break;
|
||||
}
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("couldn't find IFLA_VF_INFO for VF %d "
|
||||
"in netlink response"), vf);
|
||||
if (rc < 0)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("couldn't find IFLA_VF_INFO for VF %d "
|
||||
"in netlink response"), vf);
|
||||
cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user