Permalink
Browse files

Convert to ARC

  • Loading branch information...
1 parent acfc6d8 commit f692b6bd5edb3a6cb1793092a808f6241e99dac0 @danielctull committed Jun 28, 2011
@@ -415,6 +415,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/DCTFoundation.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DCTFoundation/DCTFoundation-Prefix.pch";
@@ -427,6 +428,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/DCTFoundation.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DCTFoundation/DCTFoundation-Prefix.pch";
@@ -439,6 +441,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
@@ -459,6 +462,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
View
@@ -37,14 +37,9 @@
#import <Foundation/Foundation.h>
-@interface DCTObservationInfo : NSObject {
- id object;
- NSKeyValueObservingOptions options;
- NSString *keyPath;
- void *context;
-}
+@interface DCTObservationInfo : NSObject
-@property (nonatomic, assign) id object;
+@property (nonatomic, weak) id object;
@property (nonatomic, assign) NSKeyValueObservingOptions options;
@property (nonatomic, copy) NSString *keyPath;
@property (nonatomic, assign) void *context;
View
@@ -42,8 +42,7 @@ @implementation DCTObservationInfo
@synthesize object, options, keyPath, context;
- (void)dealloc {
- [keyPath release], keyPath = nil;
- [super dealloc];
+ keyPath = nil;
}
@end
View
@@ -40,7 +40,7 @@
Implementation of a queue data (first in, first out) structure.
*/
@interface DCTQueue : NSObject {
- NSMutableArray *queue;
+ __strong NSMutableArray *queue;
}
/** The number of items in the queue.
View
@@ -48,10 +48,6 @@ - (id)init {
return self;
}
-- (void)dealloc {
- [queue release];
- [super dealloc];
-}
- (NSUInteger)count {
return [queue count];
@@ -66,17 +62,17 @@ - (void)push:(id)object {
}
- (id)dequeue {
- id object = [[queue objectAtIndex:0] retain];
+ id object = [queue objectAtIndex:0];
[queue removeObjectAtIndex:0];
- return [object autorelease];
+ return object;
}
- (id)pop {
return [self dequeue];
}
- (id)front {
- return [[[queue objectAtIndex:0] retain] autorelease];
+ return [queue objectAtIndex:0];
}
@end
View
@@ -41,7 +41,7 @@
to make it more useful.
*/
@interface DCTStack : NSObject {
- NSMutableArray *stack;
+ __strong NSMutableArray *stack;
}
/// @name Standard stack operations
View
@@ -48,10 +48,6 @@ - (id)init {
return self;
}
-- (void)dealloc {
- [stack release];
- [super dealloc];
-}
- (NSUInteger)count {
return [stack count];
@@ -62,21 +58,21 @@ - (void)push:(id)object {
}
- (id)pop {
- id object = [[stack lastObject] retain];
+ id object = [stack lastObject];
[stack removeLastObject];
- return [object autorelease];
+ return object;
}
- (id)topObject {
return [self top];
}
- (id)top {
- return [[[stack lastObject] retain] autorelease];
+ return [stack lastObject];
}
- (NSArray *)allObjects {
- return [[stack retain] autorelease];
+ return [[NSArray alloc] initWithArray:stack];
}
- (NSArray *)popToObject:(id)object {
@@ -86,10 +82,13 @@ - (NSArray *)popToObject:(id)object {
while (![[self topObject] isEqual:object]) {
[returnArray addObject:[self pop]];
}
- return [returnArray autorelease];
+ return [[NSArray alloc] initWithArray:returnArray];
}
- (NSArray *)popToRootObject {
+
+ if ([stack count] == 0) return nil;
+
return [self popToObject:[stack objectAtIndex:0]];
}
View
@@ -58,8 +58,7 @@ - (NSArray *)dct_subarrayWithObjectsOfClass:(Class)aClass {
if ([o isKindOfClass:aClass])
[mArray addObject:o];
- NSArray *subarray = [NSArray arrayWithArray:mArray];
- [mArray release];
+ NSArray *subarray = [[NSArray alloc] initWithArray:mArray];
return subarray;
}
@@ -93,14 +92,12 @@ - (NSArray *)dct_splitArrayIntoArraysWithCount:(NSInteger)aCount {
}
NSArray *returnArray = [splitArrays copy];
- [splitArrays release];
- return [returnArray autorelease];
+ return returnArray;
}
- (NSArray *)dct_sortedArrayUsingKey:(NSString *)key ascending:(BOOL)ascending {
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:key ascending:ascending];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
- [sortDescriptor release];
return [self sortedArrayUsingDescriptors:sortDescriptors];
}
@@ -42,7 +42,6 @@ @implementation NSDate (DCTDateComponents)
- (NSDateComponents *)dct_gregorianCalendarComponents {
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorian components:(NSSecondCalendarUnit | NSMinuteCalendarUnit | NSHourCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSWeekdayOrdinalCalendarUnit | NSWeekCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSEraCalendarUnit) fromDate:self];
- [gregorian release];
return components;
}
@@ -125,8 +124,6 @@ + (NSDate *)dct_dateWithYear:(NSInteger)year
[comps setSecond:second];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *date = [gregorian dateFromComponents:comps];
- [comps release];
- [gregorian release];
return date;
}
View
@@ -60,8 +60,6 @@ + (id)dct_dictionaryWithKeysAndObjects:(id)firstKey, ... {
id dict = [self dictionaryWithObjects:values forKeys:keys];
- [keys release];
- [values release];
return dict;
}
@@ -77,7 +75,6 @@ - (NSArray *)dct_keysForObject:(id)object {
[mArray addObject:key];
NSArray *returnArray = [NSArray arrayWithArray:mArray];
- [mArray release];
return returnArray;
}
View
@@ -12,9 +12,7 @@
@implementation NSMutableSet (DCTExtras)
- (void)dct_addBlock:(DCTBlock)block {
- id blockcopy = [block copy];
- [self addObject:blockcopy];
- [blockcopy release];
+ [self addObject:[block copy]];
}
@end

0 comments on commit f692b6b

Please sign in to comment.