Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Err... adhere to Cocoa's memory management contract, don't screw the …

…caller.
  • Loading branch information...
commit 2d7bd235f67ecffba6b60ef16e43b137373ccc45 1 parent 24dca8d
@uliwitness authored
View
6 NSArray+DeepCopy.m
@@ -17,7 +17,7 @@ @implementation NSArray (UKDeepCopy)
-(NSArray*) deepCopy
{
- NSMutableArray * theArray = [NSMutableArray arrayWithCapacity: [self count]];
+ NSMutableArray * theArray = [[NSMutableArray alloc] initWithCapacity: [self count]];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
@@ -36,7 +36,7 @@ -(NSArray*) deepCopy
-(NSMutableArray*) deepMutableContainerCopy
{
- NSMutableArray * theArray = [NSMutableArray array];
+ NSMutableArray * theArray = [[NSMutableArray alloc] init];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
@@ -55,7 +55,7 @@ -(NSMutableArray*) deepMutableContainerCopy
-(NSMutableArray*) deepMutableCopy
{
- NSMutableArray * theArray = [NSMutableArray array];
+ NSMutableArray * theArray = [[NSMutableArray alloc] init];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
View
6 NSDictionary+DeepCopy.m
@@ -17,7 +17,7 @@ @implementation NSDictionary (UKDeepCopy)
-(NSDictionary*) deepCopy
{
- NSMutableDictionary * theDict = [NSMutableDictionary dictionaryWithCapacity: [self count]];
+ NSMutableDictionary * theDict = [[NSMutableDictionary alloc] initWithCapacity: [self count]];
NSEnumerator * enny = [self keyEnumerator];
NSString * currKey = nil;
@@ -37,7 +37,7 @@ -(NSDictionary*) deepCopy
-(NSMutableDictionary*) deepMutableContainerCopy
{
- NSMutableDictionary * theDict = [NSMutableDictionary dictionary];
+ NSMutableDictionary * theDict = [[NSMutableDictionary alloc] init];
NSEnumerator * enny = [self keyEnumerator];
NSString * currKey = nil;
@@ -57,7 +57,7 @@ -(NSMutableDictionary*) deepMutableContainerCopy
-(NSMutableDictionary*) deepMutableCopy
{
- NSMutableDictionary * theDict = [NSMutableDictionary dictionary];
+ NSMutableDictionary * theDict = [[NSMutableDictionary alloc] init];
NSEnumerator * enny = [self keyEnumerator];
NSString * currKey = nil;
View
6 NSSet+DeepCopy.m
@@ -17,7 +17,7 @@ @implementation NSSet (UKDeepCopy)
-(NSSet*) deepCopy
{
- NSMutableSet * theSet = [NSMutableSet setWithCapacity: [self count]];
+ NSMutableSet * theSet = [[NSMutableSet alloc] initWithCapacity: [self count]];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
@@ -36,7 +36,7 @@ -(NSSet*) deepCopy
-(NSMutableSet*) deepMutableContainerCopy
{
- NSMutableSet * theSet = [NSMutableSet set];
+ NSMutableSet * theSet = [[NSMutableSet alloc] init];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
@@ -55,7 +55,7 @@ -(NSMutableSet*) deepMutableContainerCopy
-(NSMutableSet*) deepMutableCopy
{
- NSMutableSet * theSet = [NSMutableSet set];
+ NSMutableSet * theSet = [[NSMutableSet alloc] init];
NSEnumerator * enny = [self objectEnumerator];
id currObj = nil;
Please sign in to comment.
Something went wrong with that request. Please try again.