Move code closer to usage. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/virsecretobj.c | 62 ++++++++++++++++++++++++------------------------- src/conf/virsecretobj.h | 14 +++++------ 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 413955d..998f815 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -483,6 +483,37 @@ virSecretObjListNumOfSecrets(virSecretObjListPtr secrets, } +int +virSecretObjListGetUUIDs(virSecretObjListPtr secrets, + char **uuids, + int nuuids, + virSecretObjListACLFilter filter, + virConnectPtr conn) +{ + int ret = -1; + + struct virSecretObjListGetHelperData data = { + .conn = conn, .filter = filter, .got = 0, + .uuids = uuids, .nuuids = nuuids, .error = false }; + + virObjectLock(secrets); + virHashForEach(secrets->objs, virSecretObjListGetHelper, &data); + virObjectUnlock(secrets); + + if (data.error) + goto cleanup; + + ret = data.got; + + cleanup: + if (ret < 0) { + while (data.got) + VIR_FREE(data.uuids[--data.got]); + } + return ret; +} + + #define MATCH(FLAG) (flags & (FLAG)) static bool virSecretObjMatchFlags(virSecretObjPtr obj, @@ -605,37 +636,6 @@ virSecretObjListExport(virConnectPtr conn, int -virSecretObjListGetUUIDs(virSecretObjListPtr secrets, - char **uuids, - int nuuids, - virSecretObjListACLFilter filter, - virConnectPtr conn) -{ - int ret = -1; - - struct virSecretObjListGetHelperData data = { - .conn = conn, .filter = filter, .got = 0, - .uuids = uuids, .nuuids = nuuids, .error = false }; - - virObjectLock(secrets); - virHashForEach(secrets->objs, virSecretObjListGetHelper, &data); - virObjectUnlock(secrets); - - if (data.error) - goto cleanup; - - ret = data.got; - - cleanup: - if (ret < 0) { - while (data.got) - VIR_FREE(data.uuids[--data.got]); - } - return ret; -} - - -int virSecretObjDeleteConfig(virSecretObjPtr obj) { virSecretDefPtr def = obj->def; diff --git a/src/conf/virsecretobj.h b/src/conf/virsecretobj.h index 8038faa..82915d0 100644 --- a/src/conf/virsecretobj.h +++ b/src/conf/virsecretobj.h @@ -67,13 +67,6 @@ virSecretObjListNumOfSecrets(virSecretObjListPtr secrets, virConnectPtr conn); int -virSecretObjListExport(virConnectPtr conn, - virSecretObjListPtr secretobjs, - virSecretPtr **secrets, - virSecretObjListACLFilter filter, - unsigned int flags); - -int virSecretObjListGetUUIDs(virSecretObjListPtr secrets, char **uuids, int nuuids, @@ -81,6 +74,13 @@ virSecretObjListGetUUIDs(virSecretObjListPtr secrets, virConnectPtr conn); int +virSecretObjListExport(virConnectPtr conn, + virSecretObjListPtr secretobjs, + virSecretPtr **secrets, + virSecretObjListACLFilter filter, + unsigned int flags); + +int virSecretObjDeleteConfig(virSecretObjPtr obj); void -- 2.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list