[libvirt] [PATCHv3 01/12] lib: Add public api to enable atomic listing of guest
Eric Blake
eblake at redhat.com
Thu Jun 14 15:35:30 UTC 2012
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 at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120614/951db5a7/attachment-0001.sig>
More information about the libvir-list
mailing list