qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 04/22] vl: convert -tb-size to qemu_strtoul


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 04/22] vl: convert -tb-size to qemu_strtoul
Date: Tue, 4 Jul 2017 10:37:05 +0100
User-agent: Mutt/1.8.0 (2017-02-23)

On Mon, Jul 03, 2017 at 12:46:06PM -0700, Richard Henderson wrote:
> On 07/03/2017 09:34 AM, Paolo Bonzini wrote:
> > -extern int tcg_tb_size;
> > +extern unsigned long tcg_tb_size;
> 
> size_t would be more natural.
> 
> I don't think we support any hosts for which sizeof(size_t) !=
> sizeof(unsigned long), but perhaps
> 
>       unsigned lomg tmp;
>       if (qemu_strtoul(optarg, NULL, 0, &tmp) < 0
>             || tmp != (size_t)tmp) {
>         error_report("Invalid argument to -tb-size");
>         exit(1);
>       }
>       tcg_tb_size = tmp;
> 
> where I'd expect the extra comparison to be optimized away.

If we wanted to use size_t, then I'd suggest we added a qemu_strtoXXX
variant that directly returned a size_t, and did suitabled bounds
checking

> But I'm not overly concerned either way, so

Agreed, doesn't need fixing now

> Reviewed-by: Richard Henderson <address@hidden>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]