mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Don't include <gnustep/base/String.h>.
([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
This commit is contained in:
parent
392219f73c
commit
74a42c0111
1 changed files with 8 additions and 11 deletions
|
@ -43,7 +43,6 @@
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
#include <gnustep/base/IndexedCollection.h>
|
#include <gnustep/base/IndexedCollection.h>
|
||||||
#include <gnustep/base/IndexedCollectionPrivate.h>
|
#include <gnustep/base/IndexedCollectionPrivate.h>
|
||||||
#include <gnustep/base/String.h>
|
|
||||||
#include <gnustep/base/behavior.h>
|
#include <gnustep/base/behavior.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h> // for strstr()
|
#include <string.h> // for strstr()
|
||||||
|
@ -167,11 +166,8 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
static int done = 0;
|
if (self == [NSString class])
|
||||||
if (!done)
|
|
||||||
{
|
{
|
||||||
done = 1;
|
|
||||||
class_add_behavior([NSString class], [String class]);
|
|
||||||
NSString_concrete_class = [NSGCString class];
|
NSString_concrete_class = [NSGCString class];
|
||||||
NSString_c_concrete_class = [NSGCString class];
|
NSString_c_concrete_class = [NSGCString class];
|
||||||
NSMutableString_concrete_class = [NSGMutableCString class];
|
NSMutableString_concrete_class = [NSGMutableCString class];
|
||||||
|
@ -300,17 +296,18 @@ handle_printf_atsign (FILE *stream,
|
||||||
int fd;
|
int fd;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
stat([path cString], &buf);
|
stat ([path cString], &buf);
|
||||||
|
|
||||||
OBJC_MALLOC(s,char,buf.st_size + 1);
|
OBJC_MALLOC (s, char, buf.st_size + 1);
|
||||||
fd = open([path cString], O_RDONLY);
|
fd = open ([path cString], O_RDONLY);
|
||||||
if ( fd < 0 )
|
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;
|
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
|
- (id) initWithData: (NSData*)data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue