From: "Jan Beulich" Subject: Re: [PATCH v2 5/5] libxl, hvmloader: Don't relocate memory for MMIO hole Date: Thu, 20 Jun 2013 11:56:18 +0100 Message-ID: <51C2FBF202000078000DF53F@nat28.tlf.novell.com> References: <1371573984-28514-1-git-send-email-george.dunlap@eu.citrix.com> <1371573984-28514-5-git-send-email-george.dunlap@eu.citrix.com> <51C2C9E0.6060006@eu.citrix.com> <51C2F1A502000078000DF4B7@nat28.tlf.novell.com> <51C2D77D.90103@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap , Stefano Stabellini Cc: Ian Jackson , xen-devel@lists.xen.org, Stefano Stabellini , Ian Campbell , Hanweidong List-Id: xen-devel@lists.xenproject.org >>> On 20.06.13 at 12:29, Stefano Stabellini 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