Re: [PATCH] python: make virDomainSetSchedulerParameters accpet integer argument

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

 



On 03/19/2012 12:03 PM, Eric Blake wrote:

> 
> Why are you doing this for just VIR_TYPED_PARAM_ULLONG?  I argue that we
> should be doing it for all of the integral conversions.

In fact, I'd argue that we want new helper functions in typewrappers.c,
as counterparts to our libvirt_intWrap() and friends.  Perhaps:

/* Return 0 if obj could be unwrapped into the corresponding C type, -1
with python exception set otherwise.  */
int libvirt_intUnwrap(PyObject *obj, int *val);
int libvirt_uintUnwrap(PyObject *obj, unsigned int *val);
int libvirt_longlongUnwrap(PyObject *obj, long long *val);
int libvirt_ulonglongUnwrap(PyObject *obj, unsigned long long *val);

Then the code in question simplifies to:

case VIR_TYPED_PARAM_ULLONG:
{
    unsigned long long ullong_val;
    if (libvirt_ulonglongUnwrap(value, &ullong_val) < 0)
        goto cleanup;
    temp->value.ul = ullong_val;

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

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