[libvirt] [PATCH] Properly parse (unsigned) long long

Eric Blake eblake at redhat.com
Fri Oct 12 23:42:06 UTC 2012


On 10/12/2012 05:15 PM, Guido Günther wrote:
> This fixes problems on platforms where sizeof(long) != sizeof(long long)
> like ia32.
> 
> ---
> Cheers,
>  -- Guido
> 
>  python/generator.py |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/python/generator.py b/python/generator.py
> index a98a894..1ef76e1 100755
> --- a/python/generator.py
> +++ b/python/generator.py
> @@ -259,8 +259,8 @@ py_types = {
>      'double':  ('d', None, "double", "double"),
>      'unsigned int':  ('i', None, "int", "int"),
>      'unsigned long':  ('l', None, "long", "long"),
> -    'long long':  ('l', None, "longlong", "long long"),
> -    'unsigned long long':  ('l', None, "longlong", "long long"),
> +    'long long':  ('L', None, "longlong", "long long"),
> +    'unsigned long long':  ('K', None, "longlong", "long long"),

I had to look this up:
http://docs.python.org/c-api/arg.html

Why did you choose 'K' instead of 'L' for the unsigned version?  Either
we should also be using 'I' for 'unsigned int' for similar lack of
overflow checking, or this should be 'L'.  And since I think we want
overflow checking, I'd rather see 'unsigned long long' changed to 'L'.
ACK with that fix.

-- 
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: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121012/5e4ec831/attachment-0001.sig>


More information about the libvir-list mailing list