mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
build: more fix to avoid C99 for loop
see commit 7e5aa78d0f
* src/interface/interface_backend_udev.c: Declare variable sooner.
This commit is contained in:
parent
89cf363061
commit
39ad0001ca
@ -515,12 +515,14 @@ udevIfaceScanDirFilter(const struct dirent *entry)
|
|||||||
static void
|
static void
|
||||||
udevIfaceFreeIfaceDef(virInterfaceDef *ifacedef)
|
udevIfaceFreeIfaceDef(virInterfaceDef *ifacedef)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!ifacedef)
|
if (!ifacedef)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ifacedef->type == VIR_INTERFACE_TYPE_BRIDGE) {
|
if (ifacedef->type == VIR_INTERFACE_TYPE_BRIDGE) {
|
||||||
VIR_FREE(ifacedef->data.bridge.delay);
|
VIR_FREE(ifacedef->data.bridge.delay);
|
||||||
for (int i = 0; i < ifacedef->data.bridge.nbItf; i++) {
|
for (i = 0; i < ifacedef->data.bridge.nbItf; i++) {
|
||||||
udevIfaceFreeIfaceDef(ifacedef->data.bridge.itf[i]);
|
udevIfaceFreeIfaceDef(ifacedef->data.bridge.itf[i]);
|
||||||
}
|
}
|
||||||
VIR_FREE(ifacedef->data.bridge.itf);
|
VIR_FREE(ifacedef->data.bridge.itf);
|
||||||
@ -547,6 +549,7 @@ udevIfaceGetIfaceDef(struct udev *udev, char *name)
|
|||||||
char *vlan_parent_dev = NULL;
|
char *vlan_parent_dev = NULL;
|
||||||
struct dirent **member_list = NULL;
|
struct dirent **member_list = NULL;
|
||||||
int member_count = 0;
|
int member_count = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Allocate our interface definition structure */
|
/* Allocate our interface definition structure */
|
||||||
if (VIR_ALLOC(ifacedef) < 0) {
|
if (VIR_ALLOC(ifacedef) < 0) {
|
||||||
@ -679,7 +682,7 @@ udevIfaceGetIfaceDef(struct udev *udev, char *name)
|
|||||||
}
|
}
|
||||||
ifacedef->data.bridge.nbItf = member_count;
|
ifacedef->data.bridge.nbItf = member_count;
|
||||||
|
|
||||||
for (int i= 0; i < member_count; i++) {
|
for (i = 0; i < member_count; i++) {
|
||||||
ifacedef->data.bridge.itf[i] =
|
ifacedef->data.bridge.itf[i] =
|
||||||
udevIfaceGetIfaceDef(udev, member_list[i]->d_name);
|
udevIfaceGetIfaceDef(udev, member_list[i]->d_name);
|
||||||
VIR_FREE(member_list[i]);
|
VIR_FREE(member_list[i]);
|
||||||
@ -698,7 +701,7 @@ udevIfaceGetIfaceDef(struct udev *udev, char *name)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
for (int i = 0; i < member_count; i++) {
|
for (i = 0; i < member_count; i++) {
|
||||||
VIR_FREE(member_list[i]);
|
VIR_FREE(member_list[i]);
|
||||||
}
|
}
|
||||||
VIR_FREE(member_list);
|
VIR_FREE(member_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user