Skip to content

Commit ae1fd3d

Browse files
committed
Convert to Objective-C ARC
1 parent 0717d5d commit ae1fd3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+132
-187
lines changed

ApplicationController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ - (NSManagedObjectModel *)managedObjectModel {
237237
return managedObjectModel;
238238
}
239239

240-
managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
240+
managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
241241
return managedObjectModel;
242242
}
243243

@@ -392,10 +392,9 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification
392392

393393
- (void) dealloc {
394394

395-
[managedObjectContext release], managedObjectContext = nil;
396-
[persistentStoreCoordinator release], persistentStoreCoordinator = nil;
397-
[managedObjectModel release], managedObjectModel = nil;
398-
[super dealloc];
395+
managedObjectContext = nil;
396+
persistentStoreCoordinator = nil;
397+
managedObjectModel = nil;
399398
}
400399

401400

DBPrefsWindowController.m

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ - (void)windowDidLoad
7474
// Create a new window to display the preference views.
7575
// If the developer attached a window to this controller
7676
// in Interface Builder, it gets replaced with this one.
77-
NSPanel *panel = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000)
77+
NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000)
7878
styleMask:(NSTitledWindowMask |
7979
NSClosableWindowMask |
8080
NSMiniaturizableWindowMask)
8181
backing:NSBackingStoreBuffered
82-
defer:YES] autorelease];
82+
defer:YES];
8383
[self setWindow:panel];
84-
contentSubview = [[[NSView alloc] initWithFrame:[[[self window] contentView] frame]] autorelease];
84+
contentSubview = [[NSView alloc] initWithFrame:[[[self window] contentView] frame]];
8585
[contentSubview setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)];
8686
[[[self window] contentView] addSubview:contentSubview];
8787
[[self window] setShowsToolbarButton:NO];
@@ -90,13 +90,6 @@ - (void)windowDidLoad
9090

9191

9292

93-
- (void) dealloc {
94-
[toolbarIdentifiers release];
95-
[toolbarViews release];
96-
[toolbarItems release];
97-
[viewAnimation release];
98-
[super dealloc];
99-
}
10093

10194

10295

@@ -129,12 +122,12 @@ - (void)addView:(NSView *)view label:(NSString *)label image:(NSImage *)image
129122
NSAssert (view != nil,
130123
@"Attempted to add a nil view when calling -addView:label:image:.");
131124

132-
NSString *identifier = [[label copy] autorelease];
125+
NSString *identifier = [label copy];
133126

134127
[toolbarIdentifiers addObject:identifier];
135128
[toolbarViews setObject:view forKey:identifier];
136129

137-
NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
130+
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:identifier];
138131
[item setLabel:label];
139132
[item setImage:image];
140133
[item setTarget:self];
@@ -208,7 +201,6 @@ - (IBAction)showWindow:(id)sender
208201
[toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
209202
[toolbar setDelegate:self];
210203
[[self window] setToolbar:toolbar];
211-
[toolbar release];
212204
}
213205

214206
NSString *identifier = [self defaultViewIdentifier];

GLFileView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
- (NSString *)parseBlame:(NSString *)txt;
3030
- (NSString *)parseHTML:(NSString *)txt;
3131

32-
@property(retain) NSMutableArray *groups;
33-
@property(retain) NSString *logFormat;
32+
@property NSMutableArray *groups;
33+
@property NSString *logFormat;
3434

3535
@end

GitX.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,10 +1442,12 @@
14421442
26FC0A850875C7B200E6366F /* Debug */ = {
14431443
isa = XCBuildConfiguration;
14441444
buildSettings = {
1445+
CLANG_ENABLE_OBJC_ARC = YES;
14451446
COPY_PHASE_STRIP = NO;
14461447
FRAMEWORK_SEARCH_PATHS = "\"$(SOURCE_ROOT)\"";
14471448
GCC_DYNAMIC_NO_PIC = NO;
14481449
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
1450+
GCC_ENABLE_OBJC_GC = unsupported;
14491451
GCC_MODEL_TUNING = G5;
14501452
GCC_OPTIMIZATION_LEVEL = 0;
14511453
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1464,8 +1466,10 @@
14641466
26FC0A860875C7B200E6366F /* Release */ = {
14651467
isa = XCBuildConfiguration;
14661468
buildSettings = {
1469+
CLANG_ENABLE_OBJC_ARC = YES;
14671470
FRAMEWORK_SEARCH_PATHS = "\"$(SOURCE_ROOT)\"";
14681471
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
1472+
GCC_ENABLE_OBJC_GC = unsupported;
14691473
GCC_MODEL_TUNING = G5;
14701474
GCC_PRECOMPILE_PREFIX_HEADER = YES;
14711475
GCC_PREFIX_HEADER = GitX_Prefix.pch;

MGScopeBar/MGRecessedPopUpButtonCell.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ - (id)initTextCell:(NSString *)title pullsDown:(BOOL)pullsDown
2727
}
2828

2929

30-
- (void)dealloc
31-
{
32-
[recessedButton release];
33-
[super dealloc];
34-
}
3530

3631

3732
- (void)drawTitleWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

MGScopeBar/MGScopeBar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
BOOL _smartResizeEnabled; // whether to do our clever collapsing/expanding of buttons when resizing (Smart Resizing).
2525
}
2626

27-
@property(assign) id delegate; // should implement the MGScopeBarDelegate protocol.
27+
@property id delegate; // should implement the MGScopeBarDelegate protocol.
2828

2929
- (void)reloadData; // causes the scope-bar to reload all groups/items from its delegate.
3030
- (void)sizeToFit; // only resizes vertically to optimum height; does not affect width.

MGScopeBar/MGScopeBar.m

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ - (void)dealloc
9696
[_accessoryView removeFromSuperview];
9797
_accessoryView = nil; // weak ref
9898
}
99-
[_separatorPositions release];
100-
[_groups release];
101-
[_identifiers release];
102-
[_selectedItems release];
10399

104-
[super dealloc];
105100
}
106101

107102

@@ -121,15 +116,11 @@ - (void)reloadData
121116

122117
NSArray *subviews = [[self subviews] copy]; // so we don't mutate the collection we're iterating over.
123118
[subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
124-
[subviews release]; // because copies are retained.
119+
// because copies are retained.
125120

126-
[_separatorPositions release];
127121
_separatorPositions = nil;
128-
[_groups release];
129122
_groups = nil;
130-
[_identifiers release];
131123
_identifiers = nil;
132-
[_selectedItems release];
133124
_selectedItems = nil;
134125
_firstCollapsedGroup = NSNotFound;
135126
_lastWidth = NSNotFound;
@@ -185,7 +176,6 @@ - (void)reloadData
185176
ctrlRect.size = [labelField frame].size;
186177
[labelField setFrame:ctrlRect];
187178
[self addSubview:labelField];
188-
[labelField release];
189179

190180
xCoord += ctrlRect.size.width + SCOPE_BAR_ITEM_SPACING;
191181

@@ -713,7 +703,7 @@ - (NSButton *)buttonForItem:(NSString *)identifier inGroup:(int)groupNumber
713703

714704
[self setControl:button forIdentifier:identifier inGroup:groupNumber];
715705

716-
return [button autorelease];
706+
return button;
717707
}
718708

719709

@@ -728,7 +718,7 @@ - (NSMenuItem *)menuItemForItem:(NSString *)identifier inGroup:(int)groupNumber
728718

729719
[self setControl:menuItem forIdentifier:identifier inGroup:groupNumber];
730720

731-
return [menuItem autorelease];
721+
return menuItem;
732722
}
733723

734724

@@ -743,12 +733,10 @@ - (NSPopUpButton *)popupButtonForGroup:(NSDictionary *)group
743733
if (multiSelect) {
744734
MGRecessedPopUpButtonCell *cell = [[MGRecessedPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
745735
[popup setCell:cell];
746-
[cell release];
747736

748737
[[popup cell] setUsesItemFromMenu:NO];
749738
NSMenuItem *titleItem = [[NSMenuItem alloc] init];
750739
[[popup cell] setMenuItem:titleItem];
751-
[titleItem release];
752740
}
753741

754742
// Configure appearance and behaviour.
@@ -784,7 +772,7 @@ - (NSPopUpButton *)popupButtonForGroup:(NSDictionary *)group
784772
popFrame.origin.y = ceil(([self frame].size.height - popFrame.size.height) / 2.0);
785773
[popup setFrame:popFrame];
786774

787-
return [popup autorelease];
775+
return popup;
788776
}
789777

790778

@@ -796,7 +784,7 @@ - (void)setControl:(NSObject *)control forIdentifier:(NSString *)identifier inGr
796784

797785
NSMutableArray *identArray = [_identifiers objectForKey:identifier];
798786
if (!identArray) {
799-
identArray = [[[NSMutableArray alloc] initWithCapacity:groupNumber + 1] autorelease];
787+
identArray = [[NSMutableArray alloc] initWithCapacity:groupNumber + 1];
800788
[_identifiers setObject:identArray forKey:identifier];
801789
}
802790

@@ -875,8 +863,8 @@ - (void)updateMenuTitleForGroupAtIndex:(int)groupNumber
875863
- (void)drawRect:(NSRect)rect
876864
{
877865
// Draw gradient background.
878-
NSGradient *gradient = [[[NSGradient alloc] initWithStartingColor:SCOPE_BAR_START_COLOR_GRAY
879-
endingColor:SCOPE_BAR_END_COLOR_GRAY] autorelease];
866+
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:SCOPE_BAR_START_COLOR_GRAY
867+
endingColor:SCOPE_BAR_END_COLOR_GRAY];
880868
[gradient drawInRect:[self bounds] angle:90.0];
881869

882870
// Draw border.
@@ -935,7 +923,6 @@ - (void)setSelected:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)g
935923
BOOL informDelegate = YES;
936924

937925
if (group) {
938-
[group retain];
939926
NSDisableScreenUpdates();
940927

941928
// We found the group which this item belongs to. Obtain selection-mode and identifiers.
@@ -959,7 +946,6 @@ - (void)setSelected:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)g
959946
informDelegate = NO;
960947
}
961948
}
962-
[groupSelections release];
963949
}
964950

965951
// Change selected state of this item.
@@ -970,7 +956,6 @@ - (void)setSelected:(BOOL)selected forItem:(NSString *)identifier inGroup:(int)g
970956
[self updateMenuTitleForGroupAtIndex:groupNumber];
971957
}
972958

973-
[group release];
974959
NSEnableScreenUpdates();
975960
}
976961
}
@@ -1015,7 +1000,7 @@ - (void)updateSelectedState:(BOOL)selected forItem:(NSString *)identifier inGrou
10151000

10161001
- (NSArray *)selectedItems
10171002
{
1018-
return [[_selectedItems copy] autorelease];
1003+
return [_selectedItems copy];
10191004
}
10201005

10211006

NSString_RegEx.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ - (NSArray *) substringsMatchingRegularExpression:(NSString *)pattern count:(int
5757
break;
5858

5959
NSRange range = NSMakeRange(pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so);
60-
NSString * substring = [[[NSString alloc] initWithBytes:[self UTF8String] + range.location
60+
NSString * substring = [[NSString alloc] initWithBytes:[self UTF8String] + range.location
6161
length:range.length
62-
encoding:NSUTF8StringEncoding] autorelease];
62+
encoding:NSUTF8StringEncoding];
6363
[outMatches addObject:substring];
6464

6565
if (ranges)

OpenRecentController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ + (bool)run
1818
{
1919
OpenRecentController* new = [[OpenRecentController alloc] init];
2020
new->currentResults = [NSMutableArray array];
21-
[new->currentResults retain]; //FIXME: why ???
21+
//FIXME: why ???
2222
new->possibleResults = [NSMutableArray array];
23-
[new->possibleResults retain]; //FIXME: why ???
23+
//FIXME: why ???
2424

2525
for (NSURL *url in [[NSDocumentController sharedDocumentController] recentDocumentURLs]) {
2626
[new->possibleResults addObject: url];

PBCloneRepositoryPanel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
- (IBAction) showHideHiddenFiles:(id)sender;
3535
- (IBAction) browseDestination:(id)sender;
3636

37-
@property (assign) IBOutlet NSTextField *repositoryURL;
38-
@property (assign) IBOutlet NSTextField *destinationPath;
39-
@property (assign) IBOutlet NSTextField *errorMessage;
40-
@property (assign) IBOutlet NSView *repositoryAccessoryView;
37+
@property IBOutlet NSTextField *repositoryURL;
38+
@property IBOutlet NSTextField *destinationPath;
39+
@property IBOutlet NSTextField *errorMessage;
40+
@property IBOutlet NSView *repositoryAccessoryView;
4141

4242
@property (assign) BOOL isBare;
4343

0 commit comments

Comments
 (0)