Re: [PATCHv3 03/12] python: add API exports for virConnectListAllDomains()

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

 



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