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

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

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]