gnustep-dev
[Top][All Lists]
Advanced

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

Re: GS_IS_WHITESPACE


From: Richard Frith-Macdonald
Subject: Re: GS_IS_WHITESPACE
Date: Thu, 24 Apr 2008 16:06:41 +0100


On 24 Apr 2008, at 15:38, Richard Frith-Macdonald wrote:


On 23 Apr 2008, at 18:00, David Chisnall wrote:

Hi,

I'm looking in Foundation and finding a few cases where GS_IS_WHITESPACE is called, including one where I think there is inadequate testing that the whitespace bitmap is set up before using it (NSPropertyList:2581). Is there a reason why GNUstep is using this non-locale-aware custom macro in a potentially unsafe way, rather than using the C standard (C90) isspace()?

Sure, it's used where we must not do locale specific stuff ... ie where the decision about what is (or is not) whitespace must NOT alter with the locale set on the machine that the software is running on. Property list parsing is one of those cases where the format is fixed (and therefore a property list file is portable between apps running in different locales).

Why do you think it's unsafe? The setup is done in the +initialize method for the class, and that method is supposed to be guaranteed (by the runtime) to have been executed before any other method of the class is executed. Did I miss something?

The code looks pretty inefficient though ... it wastes a lot of memory ... probably we should replace it with something that uses static 256 bit (32 byte) bitmaps since we are dealing with 8bit characters here.





reply via email to

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