[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 04/10] secret: Introduce virSecretObjListFindBy{UUID|Usage} support

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 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


Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]