From 74a42c011141d4ee9523e377856751778a5e007d Mon Sep 17 00:00:00 2001 From: mccallum Date: Sun, 24 Nov 1996 17:20:45 +0000 Subject: [PATCH] Don't include . ([NSString +initialize]): Don't use static variable to prevent getting run twice. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1942 72102866-910b-0410-8b05-ffd578937521 --- Source/NSString.m | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Source/NSString.m b/Source/NSString.m index 62bbead52..98296d703 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include // for strstr() @@ -167,11 +166,8 @@ handle_printf_atsign (FILE *stream, + (void) initialize { - static int done = 0; - if (!done) + if (self == [NSString class]) { - done = 1; - class_add_behavior([NSString class], [String class]); NSString_concrete_class = [NSGCString class]; NSString_c_concrete_class = [NSGCString class]; NSMutableString_concrete_class = [NSGMutableCString class]; @@ -300,17 +296,18 @@ handle_printf_atsign (FILE *stream, int fd; char *s; - stat([path cString], &buf); + stat ([path cString], &buf); - OBJC_MALLOC(s,char,buf.st_size + 1); - fd = open([path cString], O_RDONLY); + OBJC_MALLOC (s, char, buf.st_size + 1); + fd = open ([path cString], O_RDONLY); if ( fd < 0 ) - [NSException raise: NSGenericException format: @"Could not open file %s", [path cString]]; + [NSException raise: NSGenericException + format: @"Could not open file %s", [path cString]]; - read(fd,(void *)s,buf.st_size); + read (fd,(void *)s,buf.st_size); s[buf.st_size] = (char)0; - return [self initWithCStringNoCopy:s length: buf.st_size freeWhenDone:YES]; + return [self initWithCStringNoCopy:s length: buf.st_size freeWhenDone: YES]; } - (id) initWithData: (NSData*)data