This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD

To: Bastian Blank <bastian@xxxxxxxxxxxx>, Christoph Egger <Christoph.Egger@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Sun, 23 Sep 2007 12:48:11 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 23 Sep 2007 04:44:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070923111256.GA10709@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acf9153D3G1YFmnKEdyrigAWy6hiGQ==
Thread-topic: [Xen-devel] [PATCH] libfsimage: Make it build on NetBSD
User-agent: Microsoft-Entourage/
On 23/9/07 12:12, "Bastian Blank" <bastian@xxxxxxxxxxxx> wrote:

> On Fri, Sep 21, 2007 at 02:39:46PM +0200, Christoph Egger wrote:
>> -  if (!*dirname || isspace (*dirname))
>> +  if (!*dirname || isspace ((uint8_t)*dirname))
> According to C99, the definition is "int isspace(int c)". Even char can
> be converted implicitely to int. Which problem do you intend to fix with
> that? If this functions are incorrectly defined on BSD, fix that their.

The ISO spec is pretty unambiguous: "The c argument is an int, the value of
which the application shall ensure is a character representable as an
unsigned char or equal to the value of the macro EOF. If the argument has
any other value, the behavior is undefined."

If we sensibly take 'representable' to mean 'representable with the same
integer value', then the casts are clearly needed for compliance. This
interpretation even makes some sense, since it explicitly disallows
collision between character code 0xff and EOF (usually -1).

And read glibc's ctype.h -- it goes to some effort to support 'signed char'
input, but makes it clear this is "for broken old programs".

This seems to be one of the ugly corners of the C spec where the truth is
not very palatable. :-)

 -- Keir

Xen-devel mailing list