On 06/11/12 23:02, Eric Blake wrote:
On 06/11/2012 04:33 AM, Peter Krempa wrote:
This patch adds export of the new API function
virConnectListAllDomains() to the libvirt-python bindings. The
virConnect object now has method "listAllDomains" that takes only the
flags parameter and returns a python list of virDomain object
corresponding to virDomainPtrs returned by the underlying api.

The implementation is done manually as the generator does not support
wrapping list of virDomainPtrs into virDomain objects.
---
+
+    for (i = 0; i < c_retval; i++) {
+        if (!((tmp = libvirt_virDomainPtrWrap(doms[i])) &&
+              !(PyList_SetItem(py_retval, i, tmp) < 0))) {

Accurate, but too many '!' and () to be read easily.  I'd write this as:

        if ((tmp = libvirt_virDomainPtrWrap(doms[i])) == NULL ||
            PyList_SetItem(py_retval, i, tmp) < 0) {

or maybe

        if (!(tmp = libvirt_virDomainPtrWrap(doms[i])) ||
            PyList_SetItem(py_retval, i, tmp) < 0) {

I've gone with this version.


ACK.

Pushed; Thanks.

Peter


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

Reply via email to