mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: Rename [n]macs and maxmacs to [n]names and maxnames
To avoid further confusion - rename the array elements to what they are.
This commit is contained in:
parent
727238de25
commit
08d4e16f88
@ -160,9 +160,9 @@ virInterfaceObjListNew(void)
|
|||||||
struct _virInterfaceObjFindMACData {
|
struct _virInterfaceObjFindMACData {
|
||||||
const char *matchStr;
|
const char *matchStr;
|
||||||
bool error;
|
bool error;
|
||||||
int nmacs;
|
int nnames;
|
||||||
int maxmacs;
|
int maxnames;
|
||||||
char **const macs;
|
char **const names;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -176,17 +176,17 @@ virInterfaceObjListFindByMACStringCb(void *payload,
|
|||||||
if (data->error)
|
if (data->error)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (data->nmacs == data->maxmacs)
|
if (data->nnames == data->maxnames)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
|
|
||||||
if (STRCASEEQ(obj->def->mac, data->matchStr)) {
|
if (STRCASEEQ(obj->def->mac, data->matchStr)) {
|
||||||
if (VIR_STRDUP(data->macs[data->nmacs], obj->def->name) < 0) {
|
if (VIR_STRDUP(data->names[data->nnames], obj->def->name) < 0) {
|
||||||
data->error = true;
|
data->error = true;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
data->nmacs++;
|
data->nnames++;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -203,9 +203,9 @@ virInterfaceObjListFindByMACString(virInterfaceObjListPtr interfaces,
|
|||||||
{
|
{
|
||||||
struct _virInterfaceObjFindMACData data = { .matchStr = mac,
|
struct _virInterfaceObjFindMACData data = { .matchStr = mac,
|
||||||
.error = false,
|
.error = false,
|
||||||
.nmacs = 0,
|
.nnames = 0,
|
||||||
.maxmacs = maxmatches,
|
.maxnames = maxmatches,
|
||||||
.macs = matches };
|
.names = matches };
|
||||||
|
|
||||||
virObjectRWLockRead(interfaces);
|
virObjectRWLockRead(interfaces);
|
||||||
virHashForEach(interfaces->objsName, virInterfaceObjListFindByMACStringCb,
|
virHashForEach(interfaces->objsName, virInterfaceObjListFindByMACStringCb,
|
||||||
@ -215,11 +215,11 @@ virInterfaceObjListFindByMACString(virInterfaceObjListPtr interfaces,
|
|||||||
if (data.error)
|
if (data.error)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return data.nmacs;
|
return data.nnames;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
while (--data.nmacs >= 0)
|
while (--data.nnames >= 0)
|
||||||
VIR_FREE(data.macs[data.nmacs]);
|
VIR_FREE(data.names[data.nnames]);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user