mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Convert 'int i' to 'size_t i' in src/interface/ files
Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7ecb44774b
commit
c0b9e9b544
@ -212,7 +212,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr conn,
|
||||
int count;
|
||||
int want = 0;
|
||||
int ret = -1;
|
||||
int i;
|
||||
size_t i;
|
||||
char **names = NULL;
|
||||
|
||||
/* List all interfaces, in case we might support new filter flags
|
||||
@ -289,7 +289,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr conn,
|
||||
ret = want;
|
||||
|
||||
cleanup:
|
||||
if (names)
|
||||
if (names && count > 0)
|
||||
for (i = 0; i < count; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
@ -306,7 +306,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr conn,
|
||||
int count = 0;
|
||||
int want = 0;
|
||||
int ret = -1;
|
||||
int i;
|
||||
size_t i;
|
||||
char **allnames = NULL;
|
||||
|
||||
count = ncf_num_of_interfaces(driver->netcf, status);
|
||||
@ -386,7 +386,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr conn,
|
||||
ret = want;
|
||||
|
||||
cleanup:
|
||||
if (allnames)
|
||||
if (allnames && count > 0)
|
||||
for (i = 0; i < count; i++)
|
||||
VIR_FREE(allnames[i]);
|
||||
VIR_FREE(allnames);
|
||||
@ -474,7 +474,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
|
||||
{
|
||||
struct interface_driver *driver = conn->interfacePrivateData;
|
||||
int count;
|
||||
int i;
|
||||
size_t i;
|
||||
struct netcf_if *iface = NULL;
|
||||
virInterfacePtr *tmp_iface_objs = NULL;
|
||||
virInterfacePtr iface_obj = NULL;
|
||||
@ -606,7 +606,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
|
||||
cleanup:
|
||||
ncf_if_free(iface);
|
||||
|
||||
if (names)
|
||||
if (names && count > 0)
|
||||
for (i = 0; i < count; i++)
|
||||
VIR_FREE(names[i]);
|
||||
VIR_FREE(names);
|
||||
|
@ -634,7 +634,7 @@ udevGetIfaceDefBond(struct udev *udev,
|
||||
{
|
||||
struct dirent **slave_list = NULL;
|
||||
int slave_count = 0;
|
||||
int i;
|
||||
size_t i;
|
||||
const char *tmp_str;
|
||||
int tmp_int;
|
||||
|
||||
@ -842,7 +842,7 @@ udevGetIfaceDefBond(struct udev *udev,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
for (i = 0; i < slave_count; i++) {
|
||||
for (i = 0; slave_count != -1 && i < slave_count; i++) {
|
||||
VIR_FREE(slave_list[i]);
|
||||
}
|
||||
VIR_FREE(slave_list);
|
||||
@ -863,7 +863,7 @@ udevGetIfaceDefBridge(struct udev *udev,
|
||||
char *member_path;
|
||||
const char *tmp_str;
|
||||
int stp;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
/* Set our type to Bridge */
|
||||
ifacedef->type = VIR_INTERFACE_TYPE_BRIDGE;
|
||||
@ -949,7 +949,7 @@ udevGetIfaceDefBridge(struct udev *udev,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
for (i = 0; i < member_count; i++) {
|
||||
for (i = 0; member_count != -1 && i < member_count; i++) {
|
||||
VIR_FREE(member_list[i]);
|
||||
}
|
||||
VIR_FREE(member_list);
|
||||
|
Loading…
Reference in New Issue
Block a user