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

Eric Blake eblake at redhat.com
Mon Mar 19 18:11:39 UTC 2012


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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120319/b89560dd/attachment-0001.sig>


More information about the libvir-list mailing list