([NSString +allocWithZone:]): New method.

([NSString +stringWithCString:byteString]): Use it.
([NSString +stringWithCString:length:]): Likewise.
([NSString +stringWithFormat:]): Likewise.
([NSString +stringWithFormat:arguments:]): Likewise.
([NSMutableString +allocWithZone:]): New method.
([NSMutableString +stringWithCapacity:]): Use it.
([NSMutableString +stringWithCString:length:]): Likewise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@676 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mccallum 1995-11-19 20:29:39 +00:00
parent f42380d816
commit b25748e37a

View file

@ -105,6 +105,11 @@ static Class NSMutableString_c_concrete_class;
} }
} }
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject([self _concreteClass], 0, z);
}
// Creating Temporary Strings // Creating Temporary Strings
+ (NSString*) localizedStringWithFormat: (NSString*) format, ... + (NSString*) localizedStringWithFormat: (NSString*) format, ...
@ -115,14 +120,14 @@ static Class NSMutableString_c_concrete_class;
+ (NSString*) stringWithCString: (const char*) byteString + (NSString*) stringWithCString: (const char*) byteString
{ {
return [[[[self _concreteCClass] alloc] initWithCString:byteString] return [[[self alloc] initWithCString:byteString]
autorelease]; autorelease];
} }
+ (NSString*) stringWithCString: (const char*)byteString + (NSString*) stringWithCString: (const char*)byteString
length: (unsigned int)length length: (unsigned int)length
{ {
return [[[[self _concreteCClass] alloc] return [[[self alloc]
initWithCString:byteString length:length] initWithCString:byteString length:length]
autorelease]; autorelease];
} }
@ -140,7 +145,7 @@ static Class NSMutableString_c_concrete_class;
id ret; id ret;
va_start(ap, format); va_start(ap, format);
ret = [[[[self _concreteClass] alloc] initWithFormat:format arguments:ap] ret = [[[self alloc] initWithFormat:format arguments:ap]
autorelease]; autorelease];
va_end(ap); va_end(ap);
return ret; return ret;
@ -149,7 +154,7 @@ static Class NSMutableString_c_concrete_class;
+ (NSString*) stringWithFormat: (NSString*)format + (NSString*) stringWithFormat: (NSString*)format
arguments: (va_list)argList arguments: (va_list)argList
{ {
return [[[[self _concreteClass] alloc] return [[[self alloc]
initWithFormat:format arguments:argList] initWithFormat:format arguments:argList]
autorelease]; autorelease];
} }
@ -929,6 +934,11 @@ static Class NSMutableString_c_concrete_class;
@implementation NSMutableString @implementation NSMutableString
+ allocWithZone: (NSZone*)z
{
return NSAllocateObject([self _mutableConcreteClass], 0, z);
}
/* xxx This method may be removed in future. */ /* xxx This method may be removed in future. */
- (void) setCString: (const char *)byteString length: (unsigned)length - (void) setCString: (const char *)byteString length: (unsigned)length
{ {
@ -949,7 +959,7 @@ static Class NSMutableString_c_concrete_class;
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity + (NSMutableString*) stringWithCapacity:(unsigned)capacity
{ {
return [[[[self _mutableConcreteClass] alloc] initWithCapacity:capacity] return [[[self alloc] initWithCapacity:capacity]
autorelease]; autorelease];
} }
@ -971,7 +981,7 @@ static Class NSMutableString_c_concrete_class;
+ (NSString*) stringWithCString: (const char*)bytes + (NSString*) stringWithCString: (const char*)bytes
length:(unsigned)length length:(unsigned)length
{ {
id n = [[[self _mutableConcreteCClass] alloc] initWithCapacity:length]; id n = [[self alloc] initWithCapacity:length];
[n setCString:bytes length:length]; [n setCString:bytes length:length];
return n; return n;
} }