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(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org