mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Minor optimisations
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4212 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5a805f1ed0
commit
325ffedf2a
9 changed files with 467 additions and 442 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Thu May 6 17:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSString.m: Minor optimisations - use ([-allocWithZone:])
|
||||
* Source/NSGCString.m: ditto
|
||||
* Source/NSGDictionary.m: ditto
|
||||
* Source/NSArray.m: ditto
|
||||
* Source/NSDictionary.m: ditto
|
||||
* Source/NSSet.m: ditto
|
||||
* Source/NSGCountedSet.m: ditto
|
||||
* Source/NSData.m: ditto
|
||||
|
||||
Thu May 6 13:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/propList.h: new file
|
||||
|
|
|
@ -92,18 +92,19 @@ static Class NSMutableArray_concrete_class;
|
|||
|
||||
+ array
|
||||
{
|
||||
return [[[self alloc] init]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()] init] autorelease];
|
||||
}
|
||||
|
||||
+ arrayWithArray: (NSArray*)array
|
||||
{
|
||||
return [[[self alloc] initWithArray: array] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: array] autorelease];
|
||||
}
|
||||
|
||||
+ arrayWithContentsOfFile: (NSString*)file
|
||||
{
|
||||
return [[[self alloc] initWithContentsOfFile: file] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: file] autorelease];
|
||||
}
|
||||
|
||||
+ arrayWithObject: anObject
|
||||
|
@ -111,7 +112,8 @@ static Class NSMutableArray_concrete_class;
|
|||
if (anObject == nil)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Tried to add nil"];
|
||||
return [[[self alloc] initWithObjects: &anObject count: 1]
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: &anObject count: 1]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
|
@ -206,7 +208,8 @@ static Class NSMutableArray_concrete_class;
|
|||
|
||||
[self getObjects: objects];
|
||||
objects[c] = anObject;
|
||||
na = [[NSArray alloc] initWithObjects: objects count: c+1];
|
||||
na = [[NSArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects count: c+1];
|
||||
}
|
||||
return [na autorelease];
|
||||
}
|
||||
|
@ -287,7 +290,8 @@ static Class NSMutableArray_concrete_class;
|
|||
{
|
||||
NSString *myString;
|
||||
|
||||
myString = [[NSString alloc] initWithContentsOfFile: file];
|
||||
myString = [[NSString allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: file];
|
||||
if (myString)
|
||||
{
|
||||
id result = [myString propertyList];
|
||||
|
@ -317,15 +321,16 @@ static Class NSMutableArray_concrete_class;
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, firstObject);
|
||||
self = [[self alloc] initWithObjects: firstObject rest: ap];
|
||||
self = [[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: firstObject rest: ap];
|
||||
va_end(ap);
|
||||
return [self autorelease];
|
||||
}
|
||||
|
||||
+ arrayWithObjects: (id*)objects count: (unsigned)count
|
||||
{
|
||||
return [[[self alloc] initWithObjects: objects count: count]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects count: count] autorelease];
|
||||
}
|
||||
|
||||
- initWithArray: (NSArray*)array
|
||||
|
@ -492,7 +497,8 @@ static Class NSMutableArray_concrete_class;
|
|||
NSMutableArray *sortedArray;
|
||||
NSArray *result;
|
||||
|
||||
sortedArray = [[NSMutableArray alloc] initWithArray: self];
|
||||
sortedArray = [[NSMutableArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: self];
|
||||
[sortedArray sortUsingFunction: comparator context: context];
|
||||
result = [NSArray arrayWithArray: sortedArray];
|
||||
[sortedArray release];
|
||||
|
@ -570,14 +576,14 @@ static Class NSMutableArray_concrete_class;
|
|||
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return [[[NSArrayEnumerator alloc] initWithArray: self]
|
||||
autorelease];
|
||||
return [[[NSArrayEnumerator allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: self] autorelease];
|
||||
}
|
||||
|
||||
- (NSEnumerator*) reverseObjectEnumerator
|
||||
{
|
||||
return [[[NSArrayEnumeratorReverse alloc] initWithArray: self]
|
||||
autorelease];
|
||||
return [[[NSArrayEnumeratorReverse allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: self] autorelease];
|
||||
}
|
||||
|
||||
- (NSString*) description
|
||||
|
@ -776,8 +782,8 @@ static NSString *indentStrings[] = {
|
|||
|
||||
+ arrayWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return [[[self alloc] initWithCapacity: numItems]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCapacity: numItems] autorelease];
|
||||
}
|
||||
|
||||
- (BOOL)writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile
|
||||
|
|
128
Source/NSData.m
128
Source/NSData.m
|
@ -268,46 +268,45 @@ failure:
|
|||
|
||||
+ (id) data
|
||||
{
|
||||
return [[[NSDataStatic alloc] initWithBytesNoCopy: 0 length: 0]
|
||||
autorelease];
|
||||
return [[[NSDataStatic allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytesNoCopy: 0 length: 0] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithBytes: (const void*)bytes
|
||||
length: (unsigned)length
|
||||
{
|
||||
return [[[dataMalloc alloc] initWithBytes: bytes length: length]
|
||||
autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithBytesNoCopy: (void*)bytes
|
||||
length: (unsigned)length
|
||||
{
|
||||
return [[[dataMalloc alloc] initWithBytesNoCopy: bytes
|
||||
length: length]
|
||||
autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytesNoCopy: bytes length: length] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfFile: (NSString*)path
|
||||
{
|
||||
return [[[dataMalloc alloc] initWithContentsOfFile: path]
|
||||
autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfMappedFile: (NSString*)path
|
||||
{
|
||||
#if HAVE_MMAP
|
||||
return [[[NSDataMappedFile alloc] initWithContentsOfMappedFile: path]
|
||||
autorelease];
|
||||
return [[[NSDataMappedFile allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfMappedFile: path] autorelease];
|
||||
#else
|
||||
return [[[dataMalloc alloc] initWithContentsOfMappedFile: path]
|
||||
autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfMappedFile: path] autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (id) dataWithData: (NSData*)data
|
||||
{
|
||||
return [[[dataMalloc alloc] initWithBytes: [data bytes]
|
||||
length: [data length]] autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: [data bytes] length: [data length]] autorelease];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -1006,8 +1005,8 @@ failure:
|
|||
+ (id) dataWithShmID: (int)anID length: (unsigned)length
|
||||
{
|
||||
#if HAVE_SHMCTL
|
||||
return [[[NSDataShared alloc] initWithShmID: anID length: length]
|
||||
autorelease];
|
||||
return [[[NSDataShared allocWithZone: NSDefaultMallocZone()]
|
||||
initWithShmID: anID length: length] autorelease];
|
||||
#else
|
||||
NSLog(@"[NSData -dataWithSmdID:length:] no shared memory support");
|
||||
return nil;
|
||||
|
@ -1017,18 +1016,18 @@ failure:
|
|||
+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned)length
|
||||
{
|
||||
#if HAVE_SHMCTL
|
||||
return [[[NSDataShared alloc] initWithBytes: bytes length: length]
|
||||
autorelease];
|
||||
return [[[NSDataShared allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
#else
|
||||
return [[[dataMalloc alloc] initWithBytes: bytes length: length]
|
||||
autorelease];
|
||||
return [[[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (id) dataWithStaticBytes: (const void*)bytes length: (unsigned)length
|
||||
{
|
||||
return [[[NSDataStatic alloc] initWithBytesNoCopy: (void*)bytes
|
||||
length: length] autorelease];
|
||||
return [[[NSDataStatic allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytesNoCopy: (void*)bytes length: length] autorelease];
|
||||
}
|
||||
|
||||
- (id) initWithBytesNoCopy: (void*)bytes
|
||||
|
@ -1111,55 +1110,52 @@ failure:
|
|||
|
||||
+ (id) data
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithCapacity: 0]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCapacity: 0] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithBytes: (const void*)bytes
|
||||
length: (unsigned)length
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithBytes: bytes
|
||||
length: length]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithBytesNoCopy: (void*)bytes
|
||||
length: (unsigned)length
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithBytesNoCopy: bytes
|
||||
length: length]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytesNoCopy: bytes length: length] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithCapacity: (unsigned)numBytes
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithCapacity: numBytes]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCapacity: numBytes] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfFile: (NSString*)path
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithContentsOfFile: path]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithContentsOfMappedFile: (NSString*)path
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithContentsOfFile: path]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithData: (NSData*)data
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithBytes: [data bytes]
|
||||
length: [data length]]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: [data bytes] length: [data length]] autorelease];
|
||||
}
|
||||
|
||||
+ (id) dataWithLength: (unsigned)length
|
||||
{
|
||||
return [[[mutableDataMalloc alloc] initWithLength: length]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithLength: length] autorelease];
|
||||
}
|
||||
|
||||
- (const void*) bytes
|
||||
|
@ -1501,8 +1497,8 @@ failure:
|
|||
+ (id) dataWithShmID: (int)anID length: (unsigned)length
|
||||
{
|
||||
#if HAVE_SHMCTL
|
||||
return [[[NSMutableDataShared alloc] initWithShmID: anID length: length]
|
||||
autorelease];
|
||||
return [[[NSMutableDataShared allocWithZone: NSDefaultMallocZone()]
|
||||
initWithShmID: anID length: length] autorelease];
|
||||
#else
|
||||
NSLog(@"[NSMutableData -dataWithSmdID:length:] no shared memory support");
|
||||
return nil;
|
||||
|
@ -1512,11 +1508,11 @@ failure:
|
|||
+ (id) dataWithSharedBytes: (const void*)bytes length: (unsigned)length
|
||||
{
|
||||
#if HAVE_SHMCTL
|
||||
return [[[NSMutableDataShared alloc] initWithBytes: bytes length: length]
|
||||
autorelease];
|
||||
return [[[NSMutableDataShared allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
#else
|
||||
return [[[mutableDataMalloc alloc] initWithBytes: bytes length: length]
|
||||
autorelease];
|
||||
return [[[mutableDataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length] autorelease];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2041,20 +2037,20 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
|
||||
- (id) copy
|
||||
{
|
||||
if (NSShouldRetainWithZone(self, NSDefaultMallocZone()))
|
||||
return [self retain];
|
||||
else
|
||||
return [[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length];
|
||||
if (NSShouldRetainWithZone(self, NSDefaultMallocZone()))
|
||||
return [self retain];
|
||||
else
|
||||
return [[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length];
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)z
|
||||
{
|
||||
if (NSShouldRetainWithZone(self, z))
|
||||
return [self retain];
|
||||
else
|
||||
return [[dataMalloc allocWithZone: z]
|
||||
initWithBytes: bytes length: length];
|
||||
if (NSShouldRetainWithZone(self, z))
|
||||
return [self retain];
|
||||
else
|
||||
return [[dataMalloc allocWithZone: z]
|
||||
initWithBytes: bytes length: length];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -2110,8 +2106,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
NSData *data;
|
||||
|
||||
data = [[NSDataStatic alloc] initWithBytesNoCopy: aBuffer
|
||||
length: bufferSize];
|
||||
data = [[NSDataStatic allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytesNoCopy: aBuffer length: bufferSize];
|
||||
[self release];
|
||||
return data;
|
||||
}
|
||||
|
@ -2263,7 +2259,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
NSLog(@"[NSDataMappedFile -initWithContentsOfMappedFile:] mapping failed for %s - %s", thePath, strerror(errno));
|
||||
close(fd);
|
||||
[self release];
|
||||
self = [dataMalloc alloc];
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
self = [self initWithContentsOfFile: path];
|
||||
}
|
||||
close(fd);
|
||||
|
@ -2320,7 +2316,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %s",
|
||||
bufferSize, strerror(errno));
|
||||
[self release];
|
||||
self = [dataMalloc alloc];
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithBytes: aBuffer length: bufferSize];
|
||||
}
|
||||
|
||||
|
@ -2331,7 +2327,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
bufferSize, strerror(errno));
|
||||
bytes = 0;
|
||||
[self release];
|
||||
self = [dataMalloc alloc];
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithBytes: aBuffer length: bufferSize];
|
||||
}
|
||||
length = bufferSize;
|
||||
|
@ -2414,7 +2410,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
- (id) copy
|
||||
{
|
||||
return [[dataMalloc allocWithZone: NSDefaultMallocZone()]
|
||||
initWithBytes: bytes length: length];
|
||||
initWithBytes: bytes length: length];
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)z
|
||||
|
@ -2989,7 +2985,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory get failed for %u - %s", bufferSize, strerror(errno));
|
||||
[self release];
|
||||
self = [mutableDataMalloc alloc];
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithCapacity: bufferSize];
|
||||
}
|
||||
|
||||
|
@ -3000,7 +2996,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory attach failed for %u - %s", bufferSize, strerror(e));
|
||||
bytes = 0;
|
||||
[self release];
|
||||
self = [mutableDataMalloc alloc];
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithCapacity: bufferSize];
|
||||
}
|
||||
length = 0;
|
||||
|
|
|
@ -142,23 +142,21 @@ static Class NSMutableDictionary_concrete_class;
|
|||
|
||||
+ dictionary
|
||||
{
|
||||
return [[[self alloc] init]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()] init] autorelease];
|
||||
}
|
||||
|
||||
+ dictionaryWithDictionary: (NSDictionary*)otherDictionary
|
||||
{
|
||||
return [[[self alloc] initWithDictionary: otherDictionary] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithDictionary: otherDictionary] autorelease];
|
||||
}
|
||||
|
||||
+ dictionaryWithObjects: (id*)objects
|
||||
forKeys: (id*)keys
|
||||
count: (unsigned)count
|
||||
{
|
||||
return [[[self alloc] initWithObjects: objects
|
||||
forKeys: keys
|
||||
count: count]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects forKeys: keys count: count] autorelease];
|
||||
}
|
||||
|
||||
- (unsigned) hash
|
||||
|
@ -274,8 +272,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
}
|
||||
}
|
||||
NSAssert (argi % 2 == 0, NSInvalidArgumentException);
|
||||
d = [[[self alloc] initWithObjects: objects forKeys: keys
|
||||
count: num_pairs] autorelease];
|
||||
d = [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects forKeys: keys count: num_pairs] autorelease];
|
||||
OBJC_FREE(objects);
|
||||
OBJC_FREE(keys);
|
||||
return d;
|
||||
|
@ -286,14 +284,14 @@ static Class NSMutableDictionary_concrete_class;
|
|||
|
||||
+ dictionaryWithObjects: (NSArray*)objects forKeys: (NSArray*)keys
|
||||
{
|
||||
return [[[self alloc] initWithObjects: objects forKeys: keys]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects forKeys: keys] autorelease];
|
||||
}
|
||||
|
||||
+ dictionaryWithObject: (id)object forKey: (id)key
|
||||
{
|
||||
return [[[self alloc] initWithObjects: &object forKeys: &key count: 1]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: &object forKeys: &key count: 1] autorelease];
|
||||
}
|
||||
|
||||
/* Override superclass's designated initializer */
|
||||
|
@ -346,7 +344,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
{
|
||||
NSString *myString;
|
||||
|
||||
myString = [[NSString alloc] initWithContentsOfFile: path];
|
||||
myString = [[NSString allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path];
|
||||
if (myString)
|
||||
{
|
||||
id result;
|
||||
|
@ -374,8 +373,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
|
||||
+ dictionaryWithContentsOfFile: (NSString *)path
|
||||
{
|
||||
return [[[self alloc] initWithContentsOfFile: path]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithContentsOfFile: path] autorelease];
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: other
|
||||
|
@ -418,8 +417,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
NSAssert (k[i], NSInternalInconsistencyException);
|
||||
}
|
||||
NSAssert (![e nextObject], NSInternalInconsistencyException);
|
||||
return [[[NSArray alloc] initWithObjects: k count: c]
|
||||
autorelease];
|
||||
return [[[NSArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: k count: c] autorelease];
|
||||
}
|
||||
|
||||
- (NSArray*) allValues
|
||||
|
@ -434,8 +433,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
NSAssert (k[i], NSInternalInconsistencyException);
|
||||
}
|
||||
NSAssert (![e nextObject], NSInternalInconsistencyException);
|
||||
return [[[NSArray alloc] initWithObjects: k count: c]
|
||||
autorelease];
|
||||
return [[[NSArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: k count: c] autorelease];
|
||||
}
|
||||
|
||||
- (NSArray*) allKeysForObject: anObject
|
||||
|
@ -449,8 +448,8 @@ static Class NSMutableDictionary_concrete_class;
|
|||
a[c++] = k;
|
||||
if (c == 0)
|
||||
return nil;
|
||||
return [[[NSArray alloc] initWithObjects: a count: c]
|
||||
autorelease];
|
||||
return [[[NSArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: a count: c] autorelease];
|
||||
}
|
||||
|
||||
struct foo { NSDictionary *d; SEL s; IMP i; };
|
||||
|
@ -717,8 +716,8 @@ static NSString *indentStrings[] = {
|
|||
|
||||
+ dictionaryWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return [[[self alloc] initWithCapacity: numItems]
|
||||
autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCapacity: numItems] autorelease];
|
||||
}
|
||||
|
||||
/* Override superclass's designated initializer */
|
||||
|
|
|
@ -590,8 +590,8 @@ static IMP msInitImp; /* designated initialiser for mutable */
|
|||
}
|
||||
*ptr++ = '"';
|
||||
*ptr = '\0';
|
||||
result = [[_fastCls._NSGCString alloc] initWithCStringNoCopy: buf
|
||||
length: length+2 fromZone: z];
|
||||
result = [[_fastCls._NSGCString allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCStringNoCopy: buf length: length+2 fromZone: z];
|
||||
[output appendString: result];
|
||||
[result release];
|
||||
}
|
||||
|
|
|
@ -248,7 +248,8 @@
|
|||
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return [[[NSGCountedSetEnumerator alloc] initWithSet: self] autorelease];
|
||||
return [[[NSGCountedSetEnumerator allocWithZone: NSDefaultMallocZone()]
|
||||
initWithSet: self] autorelease];
|
||||
}
|
||||
|
||||
- (void) removeObject: (NSObject*)anObject
|
||||
|
|
|
@ -290,14 +290,14 @@ myEqual(id self, id other)
|
|||
|
||||
- (NSEnumerator*) keyEnumerator
|
||||
{
|
||||
return [[[NSGDictionaryKeyEnumerator alloc] initWithDictionary: self]
|
||||
autorelease];
|
||||
return [[[NSGDictionaryKeyEnumerator allocWithZone: NSDefaultMallocZone()]
|
||||
initWithDictionary: self] autorelease];
|
||||
}
|
||||
|
||||
- (NSEnumerator*) objectEnumerator
|
||||
{
|
||||
return [[[NSGDictionaryObjectEnumerator alloc] initWithDictionary: self]
|
||||
autorelease];
|
||||
return [[[NSGDictionaryObjectEnumerator allocWithZone: NSDefaultMallocZone()]
|
||||
initWithDictionary: self] autorelease];
|
||||
}
|
||||
|
||||
- (id) objectForKey: aKey
|
||||
|
|
|
@ -72,37 +72,42 @@ static Class NSMutableSet_concrete_class;
|
|||
|
||||
+ set
|
||||
{
|
||||
return [[[self alloc] init] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()] init] autorelease];
|
||||
}
|
||||
|
||||
+ setWithObjects: (id*)objects
|
||||
count: (unsigned)count
|
||||
{
|
||||
return [[[self alloc] initWithObjects: objects count: count] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: objects count: count] autorelease];
|
||||
}
|
||||
|
||||
+ setWithArray: (NSArray*)objects
|
||||
{
|
||||
return [[[self alloc] initWithArray: objects] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithArray: objects] autorelease];
|
||||
}
|
||||
|
||||
+ setWithObject: anObject
|
||||
{
|
||||
return [[[self alloc] initWithObjects: &anObject count: 1] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: &anObject count: 1] autorelease];
|
||||
}
|
||||
|
||||
+ setWithObjects: firstObject, ...
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, firstObject);
|
||||
self = [[self alloc] initWithObjects: firstObject rest: ap];
|
||||
self = [[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: firstObject rest: ap];
|
||||
va_end(ap);
|
||||
return [self autorelease];
|
||||
}
|
||||
|
||||
+ setWithSet: (NSSet*)aSet
|
||||
{
|
||||
return [[[self alloc] initWithSet: aSet] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithSet: aSet] autorelease];
|
||||
}
|
||||
|
||||
+ allocWithZone: (NSZone*)z
|
||||
|
@ -277,7 +282,8 @@ static Class NSMutableSet_concrete_class;
|
|||
{
|
||||
k[i] = [e nextObject];
|
||||
}
|
||||
return [[[NSArray alloc] initWithObjects: k count: c] autorelease];
|
||||
return [[[NSArray allocWithZone: NSDefaultMallocZone()]
|
||||
initWithObjects: k count: c] autorelease];
|
||||
}
|
||||
|
||||
- (id) anyObject
|
||||
|
@ -427,7 +433,8 @@ static Class NSMutableSet_concrete_class;
|
|||
|
||||
+ (id) setWithCapacity: (unsigned)numItems
|
||||
{
|
||||
return [[[self alloc] initWithCapacity: numItems] autorelease];
|
||||
return [[[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithCapacity: numItems] autorelease];
|
||||
}
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue