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

Re: [Xen-devel] [PATCH v2 5/5] libxl, hvmloader: Don't relocate memory for MMIO hole



>>> On 20.06.13 at 12:29, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> 
>>> wrote:
> On Thu, 20 Jun 2013, George Dunlap wrote:
>> On 20/06/13 11:12, Jan Beulich wrote:
>> > However, if we want to be on the safe side and also make the
>> > code work with a compiler that doesn't have a built-in _Bool, I'd
>> > think
>> > 
>> >      allow_memory_relocate = !s || strtoll(s, NULL, 0);
>> > 
>> > would be the better statement (without any if() surrounding it,
>> > and without the variable declaration having an initializer.
>> 
>> Doing this would effectively hide the "default" value.  This is bad because 
>> 1)
>> it's not clear what the default is to someone just scanning the code, 2) it's
>> hard to change.  (Consider how you'd modify the above statement if you wanted
>> to default to 0 instead.)
> 
> I would avoid the strtoll altogether:
> 
> if (s != NULL && s[0] != '0')
>     allow_memory_relocate = 1;
> else
>     allow_memory_relocate = 0;

Let's not add hacks like this - a string of "0x1" ought to not be
mis-interpreted as meaning 0.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.