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

Re: [libvirt] [PATCHv3 01/12] lib: Add public api to enable atomic listing of guest



On 06/11/2012 04:33 AM, Peter Krempa wrote:
> This patch adds a new public api that lists domains. The new approach is
> different from those used before. There are key points to this:
> 

> +int
> +virConnectListAllDomains(virConnectPtr conn,
> +                         virDomainPtr **domains,
> +                         unsigned int flags)
> +{
> +    VIR_DEBUG("conn=%p, domains=%p, flags=%x", conn, domains, flags);
> +
> +    virResetLastError();
> +
> +    if (!VIR_IS_CONNECT(conn)) {
> +        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
> +        virDispatchError(NULL);
> +        return -1;
> +    }
> +
> +    if (domains)
> +        *domains = NULL;

If we are going to guarantee that *domains is NULL on error, then you
need to hoist this statement above the !VIR_IS_CONNECT(conn) clause.

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