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. > --- > Diff to v2: > - Added check for NULL return from libvirt_virDomainPtrWrap() > static PyObject * > libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED, > - PyObject *args) { > + PyObject *args) { As long as we're touching this line, move the { that starts a function body to its own line. > + > + 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) { ACK. -- 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