mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
([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:
parent
018ab339f0
commit
6cb3e1df6a
1 changed files with 16 additions and 6 deletions
|
@ -105,6 +105,11 @@ static Class NSMutableString_c_concrete_class;
|
|||
}
|
||||
}
|
||||
|
||||
+ allocWithZone: (NSZone*)z
|
||||
{
|
||||
return NSAllocateObject([self _concreteClass], 0, z);
|
||||
}
|
||||
|
||||
// Creating Temporary Strings
|
||||
|
||||
+ (NSString*) localizedStringWithFormat: (NSString*) format, ...
|
||||
|
@ -115,14 +120,14 @@ static Class NSMutableString_c_concrete_class;
|
|||
|
||||
+ (NSString*) stringWithCString: (const char*) byteString
|
||||
{
|
||||
return [[[[self _concreteCClass] alloc] initWithCString:byteString]
|
||||
return [[[self alloc] initWithCString:byteString]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
+ (NSString*) stringWithCString: (const char*)byteString
|
||||
length: (unsigned int)length
|
||||
{
|
||||
return [[[[self _concreteCClass] alloc]
|
||||
return [[[self alloc]
|
||||
initWithCString:byteString length:length]
|
||||
autorelease];
|
||||
}
|
||||
|
@ -140,7 +145,7 @@ static Class NSMutableString_c_concrete_class;
|
|||
id ret;
|
||||
|
||||
va_start(ap, format);
|
||||
ret = [[[[self _concreteClass] alloc] initWithFormat:format arguments:ap]
|
||||
ret = [[[self alloc] initWithFormat:format arguments:ap]
|
||||
autorelease];
|
||||
va_end(ap);
|
||||
return ret;
|
||||
|
@ -149,7 +154,7 @@ static Class NSMutableString_c_concrete_class;
|
|||
+ (NSString*) stringWithFormat: (NSString*)format
|
||||
arguments: (va_list)argList
|
||||
{
|
||||
return [[[[self _concreteClass] alloc]
|
||||
return [[[self alloc]
|
||||
initWithFormat:format arguments:argList]
|
||||
autorelease];
|
||||
}
|
||||
|
@ -929,6 +934,11 @@ static Class NSMutableString_c_concrete_class;
|
|||
|
||||
@implementation NSMutableString
|
||||
|
||||
+ allocWithZone: (NSZone*)z
|
||||
{
|
||||
return NSAllocateObject([self _mutableConcreteClass], 0, z);
|
||||
}
|
||||
|
||||
/* xxx This method may be removed in future. */
|
||||
- (void) setCString: (const char *)byteString length: (unsigned)length
|
||||
{
|
||||
|
@ -949,7 +959,7 @@ static Class NSMutableString_c_concrete_class;
|
|||
|
||||
+ (NSMutableString*) stringWithCapacity:(unsigned)capacity
|
||||
{
|
||||
return [[[[self _mutableConcreteClass] alloc] initWithCapacity:capacity]
|
||||
return [[[self alloc] initWithCapacity:capacity]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
|
@ -971,7 +981,7 @@ static Class NSMutableString_c_concrete_class;
|
|||
+ (NSString*) stringWithCString: (const char*)bytes
|
||||
length:(unsigned)length
|
||||
{
|
||||
id n = [[[self _mutableConcreteCClass] alloc] initWithCapacity:length];
|
||||
id n = [[self alloc] initWithCapacity:length];
|
||||
[n setCString:bytes length:length];
|
||||
return n;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue