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.



_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to