mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
secret: Change variable names for list traversals
Rather than 'nuuids' it should be 'maxuuids' and rather than 'got' it should be 'nuuids'. Alter the logic of the list traversal to utilize those names. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
1298822e2a
commit
4a24498c4a
@ -436,9 +436,9 @@ virSecretObjListAdd(virSecretObjListPtr secrets,
|
|||||||
struct virSecretObjListGetHelperData {
|
struct virSecretObjListGetHelperData {
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
virSecretObjListACLFilter filter;
|
virSecretObjListACLFilter filter;
|
||||||
int got;
|
|
||||||
char **uuids;
|
|
||||||
int nuuids;
|
int nuuids;
|
||||||
|
char **uuids;
|
||||||
|
int maxuuids;
|
||||||
bool error;
|
bool error;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ virSecretObjListGetHelper(void *payload,
|
|||||||
if (data->error)
|
if (data->error)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (data->nuuids >= 0 && data->got == data->nuuids)
|
if (data->maxuuids >= 0 && data->nuuids == data->maxuuids)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
@ -473,10 +473,10 @@ virSecretObjListGetHelper(void *payload,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
virUUIDFormat(def->uuid, uuidstr);
|
||||||
data->uuids[data->got] = uuidstr;
|
data->uuids[data->nuuids] = uuidstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->got++;
|
data->nuuids++;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virObjectUnlock(obj);
|
virObjectUnlock(obj);
|
||||||
@ -490,14 +490,14 @@ virSecretObjListNumOfSecrets(virSecretObjListPtr secrets,
|
|||||||
virConnectPtr conn)
|
virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct virSecretObjListGetHelperData data = {
|
struct virSecretObjListGetHelperData data = {
|
||||||
.conn = conn, .filter = filter, .got = 0,
|
.conn = conn, .filter = filter, .nuuids = 0,
|
||||||
.uuids = NULL, .nuuids = -1, .error = false };
|
.uuids = NULL, .maxuuids = -1, .error = false };
|
||||||
|
|
||||||
virObjectLock(secrets);
|
virObjectLock(secrets);
|
||||||
virHashForEach(secrets->objs, virSecretObjListGetHelper, &data);
|
virHashForEach(secrets->objs, virSecretObjListGetHelper, &data);
|
||||||
virObjectUnlock(secrets);
|
virObjectUnlock(secrets);
|
||||||
|
|
||||||
return data.got;
|
return data.nuuids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -622,13 +622,13 @@ virSecretObjListExport(virConnectPtr conn,
|
|||||||
int
|
int
|
||||||
virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
|
virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
|
||||||
char **uuids,
|
char **uuids,
|
||||||
int nuuids,
|
int maxuuids,
|
||||||
virSecretObjListACLFilter filter,
|
virSecretObjListACLFilter filter,
|
||||||
virConnectPtr conn)
|
virConnectPtr conn)
|
||||||
{
|
{
|
||||||
struct virSecretObjListGetHelperData data = {
|
struct virSecretObjListGetHelperData data = {
|
||||||
.conn = conn, .filter = filter, .got = 0,
|
.conn = conn, .filter = filter, .nuuids = 0,
|
||||||
.uuids = uuids, .nuuids = nuuids, .error = false };
|
.uuids = uuids, .maxuuids = maxuuids, .error = false };
|
||||||
|
|
||||||
virObjectLock(secrets);
|
virObjectLock(secrets);
|
||||||
virHashForEach(secrets->objs, virSecretObjListGetHelper, &data);
|
virHashForEach(secrets->objs, virSecretObjListGetHelper, &data);
|
||||||
@ -637,11 +637,11 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
|
|||||||
if (data.error)
|
if (data.error)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return data.got;
|
return data.nuuids;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
while (data.got)
|
while (--data.nuuids)
|
||||||
VIR_FREE(data.uuids[--data.got]);
|
VIR_FREE(data.uuids[data.nuuids]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ virSecretObjListExport(virConnectPtr conn,
|
|||||||
int
|
int
|
||||||
virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
|
virSecretObjListGetUUIDs(virSecretObjListPtr secrets,
|
||||||
char **uuids,
|
char **uuids,
|
||||||
int nuuids,
|
int maxuuids,
|
||||||
virSecretObjListACLFilter filter,
|
virSecretObjListACLFilter filter,
|
||||||
virConnectPtr conn);
|
virConnectPtr conn);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user