[libvirt] [PATCH] virdbustest: Don't pass number of arguments as long long

Guido Günther agx at sigxcpu.org
Thu Jul 25 14:23:46 UTC 2013


On Thu, Jul 25, 2013 at 07:37:48AM -0600, Eric Blake wrote:
> On 07/25/2013 03:27 AM, Daniel P. Berrange wrote:
> 
> >> This fix looks correct, but it's annoying that we have to cast the 'a'
> >> length argument in every caller.  I'm wondering if a better fix would be
> >> to virDBusMessageEncode to take an 'int' instead of a 'size_t' arg for
> >> "a" length; even though that is technically an arbitrary limitation on
> >> 64-bit platforms, I seriously doubt anyone plans to use dBus to send
> >> more than 2G of objects.
> > 
> > The code requires an int already
> > 
> >             narray = va_arg(args, int);
> 
> Yay - the underlying implementation is correct.
> 
> > 
> > so both the (long long) and (size_t) casts are bogus. We can just
> > remove the cast completely.
> 
> Serves me right for not checking whether the va_arg was using the right
> type in the first place.  Guido's second version that drops the cast
> completely is correct.

Same here. I assumed size_t but should have double checked.
Pushed now, thanks,
 -- Guido

> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 





More information about the libvir-list mailing list