[libvirt] [PATCH 04/10] secret: Introduce virSecretObjListFindBy{UUID|Usage} support
Eric Blake
eblake at redhat.com
Thu Mar 17 23:33:37 UTC 2016
On 03/02/2016 11:55 AM, John Ferlan wrote:
> New API's including unlocked and Locked versions in order to be able
> to use in either manner.
>
> Support for searching hash object lists instead of linked lists will
> replace existing secret_driver functions secretFindByUUID and
> secretFindByUsage
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> src/conf/secret_conf.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++
> src/conf/secret_conf.h | 14 +++++
> 2 files changed, 158 insertions(+)
>
> +/**
> + * virSecretObjFindByUUIDLocked:
> + ret = virHashLookup(secrets->objs, uuidstr);
> + if (ret)
> + virObjectRef(ret);
> + return ret;
It's safe to write:
return virObjectRef(virHashLookup(...));
since virObjectRef intentionally has sane handling of NULL. Of course,
you were just copying existing practice, and maybe the more verbose form
is arguably more legible, so I don't care if you change it. (Or maybe a
followup patch the other code you were copying from to use the compact
form...)
ACK
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160317/3899326b/attachment-0001.sig>
More information about the libvir-list
mailing list