Re: [libvirt] PATCH: 6/7: Python binding

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

 



On Thu, Nov 20, 2008 at 05:58:16PM +0000, Daniel P. Berrange wrote:
> This is the python API, again just changed to cope with removal of the
> ByCaps API calls

  looks fine,

[...]
> diff -r 105e73557ef8 python/libvir.c
> --- a/python/libvir.c	Thu Nov 20 16:27:06 2008 +0000
> +++ b/python/libvir.c	Thu Nov 20 16:43:08 2008 +0000
[...]
> +static PyObject *
> +libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
> +                              PyObject *args) {
> +    PyObject *py_retval;
> +    char **names = NULL;
> +    int c_retval, i;
> +    virNodeDevicePtr dev;
> +    PyObject *pyobj_dev;
> +
> +    if (!PyArg_ParseTuple(args, (char *)"O:virNodeDeviceListCaps", &pyobj_dev))
> +        return(NULL);
> +    dev = (virNodeDevicePtr) PyvirNodeDevice_Get(pyobj_dev);
> +
> +    c_retval = virNodeDeviceNumOfCaps(dev);
> +    if (c_retval < 0)
> +        return VIR_PY_NONE;
> +
> +    if (c_retval) {
> +        names = malloc(sizeof(*names) * c_retval);
> +        if (!names)
> +            return VIR_PY_NONE;
> +        c_retval = virNodeDeviceListCaps(dev, names, c_retval);
> +        if (c_retval < 0) {
> +            free(names);
> +            return VIR_PY_NONE;
> +        }
> +    }
> +    py_retval = PyList_New(c_retval);
> +
> +    if (names) {
> +        for (i = 0;i < c_retval;i++) {
> +            PyList_SetItem(py_retval, i, libvirt_constcharPtrWrap(names[i]));
> +            free(names[i]);
> +        }
> +        free(names);
> +    }
> +
> +    return(py_retval);
> +}

  But I don't think we need that one anymore, right ?

  +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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