Skip to content

Commit 40ed59b

Browse files
committed
Revert "Some MRC to ARC conversions in GitUpKit (#827)"
9282c9b
1 parent 6abebbf commit 40ed59b

File tree

7 files changed

+51
-13
lines changed

7 files changed

+51
-13
lines changed

GitUpKit/Core/GCCommitDatabase.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
#if __has_feature(objc_arc)
17+
#error This file requires MRC
18+
#endif
19+
1620
#import <sqlite3.h>
1721

1822
#import "GCPrivate.h"
@@ -364,6 +368,7 @@ - (instancetype)initWithRepository:(GCRepository*)repository databasePath:(NSStr
364368
_options = options;
365369

366370
if (![self _initializeDatabase:path error:error]) {
371+
[self release];
367372
return nil;
368373
}
369374

@@ -372,27 +377,32 @@ - (instancetype)initWithRepository:(GCRepository*)repository databasePath:(NSStr
372377
NSInteger currentVersion = [self _readVersion];
373378
if (currentVersion == version) {
374379
if (![self _checkReady:error]) {
380+
[self release];
375381
return nil;
376382
}
377383
} else {
378384
if (_options & kGCCommitDatabaseOptions_QueryOnly) {
379385
GC_SET_GENERIC_ERROR(@"Database is query-only");
386+
[self release];
380387
return nil;
381388
}
382389
sqlite3_close(_database);
383390
_database = NULL;
384391
XLOG_WARNING(@"Commit database for \"%@\" has an incompatible version (%li) and must be regenerated", _repository.repositoryPath, (long)currentVersion);
385392
if (![[NSFileManager defaultManager] removeItemAtPath:path error:error] || ![self _initializeDatabase:path error:error] || ![self _initializeSchema:version error:error]) {
393+
[self release];
386394
return nil;
387395
}
388396
}
389397
} else {
390398
if (![self _initializeSchema:version error:error]) {
399+
[self release];
391400
return nil;
392401
}
393402
}
394403

395404
if (![self _initializeStatements:error]) {
405+
[self release];
396406
return nil;
397407
}
398408
}
@@ -407,6 +417,10 @@ - (void)dealloc {
407417
free(_statements);
408418
}
409419
sqlite3_close(_database);
420+
421+
[_databasePath release];
422+
423+
[super dealloc];
410424
}
411425

412426
#if DEBUG
@@ -889,6 +903,10 @@ - (BOOL)_addCommitsForTip:(const git_oid*)tipOID handler:(BOOL (^)())handler err
889903
success = YES;
890904

891905
cleanup:
906+
[deletedWords release];
907+
[addedWords release];
908+
[deletedLines release];
909+
[addedLines release];
892910
git_commit_free(mainParent);
893911
GC_LIST_FOR_LOOP_POINTER(newRow, itemPtr) {
894912
git_commit_free(itemPtr->commit);
@@ -1172,6 +1190,7 @@ - (NSArray*)findCommitsUsingHistory:(GCHistory*)history matching:(NSString*)matc
11721190
CHECK_LIBGIT2_FUNCTION_CALL(goto cleanup, status, == GIT_OK);
11731191
GCCommit* commit = [[GCCommit alloc] initWithRepository:_repository commit:rawCommit];
11741192
[results addObject:commit];
1193+
[commit release];
11751194
}
11761195
}
11771196
CALL_SQLITE_FUNCTION_GOTO(cleanup, sqlite3_reset, statements[kStatement_SearchCommits]);

GitUpKit/Core/GCMacros.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ static inline BOOL __GCPointerListContains(GCPointerList* list, void* pointer) {
177177

178178
#define GC_POINTER_LIST_CONTAINS(name, pointer) __GCPointerListContains(&name, pointer)
179179

180-
#define GC_POINTER_LIST_FOR_LOOP_NO_BRIDGE(name, type, variable) \
181-
type variable = (type)GC_POINTER_LIST_GET(name, 0); \
182-
for (size_t __##variable = 0; (__##variable < name.count) && (variable = (type)GC_POINTER_LIST_GET(name, __##variable), 1); ++__##variable)
180+
#define GC_POINTER_LIST_FOR_LOOP_VARIABLE(name, variable) \
181+
variable = GC_POINTER_LIST_GET(name, 0); \
182+
for (size_t __##variable = 0; (__##variable < name.count) && (variable = GC_POINTER_LIST_GET(name, __##variable), 1); ++__##variable)
183183

184184
#define GC_POINTER_LIST_FOR_LOOP(name, type, variable) \
185-
type variable = (__bridge type)GC_POINTER_LIST_GET(name, 0); \
186-
for (size_t __##variable = 0; (__##variable < name.count) && (variable = (__bridge type)GC_POINTER_LIST_GET(name, __##variable), 1); ++__##variable)
185+
type variable; \
186+
GC_POINTER_LIST_FOR_LOOP_VARIABLE(name, variable)
187187

188188
#define GC_POINTER_LIST_REVERSE_FOR_LOOP(name, type, variable) \
189189
type variable = name.count ? GC_POINTER_LIST_GET(name, name.count - 1) : NULL; \

GitUpKit/Core/GCRemote.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ - (BOOL)_pushAllReferencesToRemote:(git_remote*)remote branches:(BOOL)branches t
523523
if (success) {
524524
success = [self _pushToRemote:remote refspecs:(const char**)GC_POINTER_LIST_ROOT(buffers) count:GC_POINTER_LIST_COUNT(buffers) error:error];
525525
}
526-
GC_POINTER_LIST_FOR_LOOP_NO_BRIDGE(buffers, char*, buffer) {
526+
GC_POINTER_LIST_FOR_LOOP(buffers, char*, buffer) {
527527
free(buffer);
528528
}
529529
GC_POINTER_LIST_FREE(buffers);

GitUpKit/GitUpKit.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
E267E1D01B84D80500BAB377 /* GCRepository+Status.h in Headers */ = {isa = PBXBuildFile; fileRef = E20EB08D19FC76160031A075 /* GCRepository+Status.h */; settings = {ATTRIBUTES = (Public, ); }; };
164164
E267E1D11B84D83100BAB377 /* GCBranch.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C338DC19F85C8600063D95 /* GCBranch.m */; };
165165
E267E1D21B84D83100BAB377 /* GCCommit.m in Sources */ = {isa = PBXBuildFile; fileRef = E2C338DE19F85C8600063D95 /* GCCommit.m */; };
166-
E267E1D31B84D83100BAB377 /* GCCommitDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = E2FEED451AEAA6AD00CBED80 /* GCCommitDatabase.m */; };
166+
E267E1D31B84D83100BAB377 /* GCCommitDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = E2FEED451AEAA6AD00CBED80 /* GCCommitDatabase.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
167167
E267E1D41B84D83100BAB377 /* GCDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = E2B14B5D1A8A764400003E64 /* GCDiff.m */; };
168168
E267E1D51B84D83100BAB377 /* GCFoundation.m in Sources */ = {isa = PBXBuildFile; fileRef = E2790D411ACB1B1100965A98 /* GCFoundation.m */; };
169169
E267E1D61B84D83100BAB377 /* GCFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = E21739F21A4FE39E00EC6777 /* GCFunctions.m */; };
@@ -206,13 +206,13 @@
206206
E267E2121B84DB4200BAB377 /* GINode.h in Headers */ = {isa = PBXBuildFile; fileRef = E2D4DEA61A4D57AA00B6AF66 /* GINode.h */; settings = {ATTRIBUTES = (Public, ); }; };
207207
E267E2131B84DB4200BAB377 /* GISplitDiffView.h in Headers */ = {isa = PBXBuildFile; fileRef = E2891AB11AE15BB600E58C77 /* GISplitDiffView.h */; settings = {ATTRIBUTES = (Public, ); }; };
208208
E267E2141B84DB4200BAB377 /* GIUnifiedDiffView.h in Headers */ = {isa = PBXBuildFile; fileRef = E2C9FF861AA510170051B2AE /* GIUnifiedDiffView.h */; settings = {ATTRIBUTES = (Public, ); }; };
209-
E267E2151B84DB6E00BAB377 /* GIBranch.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEAE1A4D592000B6AF66 /* GIBranch.m */; };
209+
E267E2151B84DB6E00BAB377 /* GIBranch.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEAE1A4D592000B6AF66 /* GIBranch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
210210
E267E2161B84DB6E00BAB377 /* GIDiffView.m in Sources */ = {isa = PBXBuildFile; fileRef = E2891AB51AE1684A00E58C77 /* GIDiffView.m */; };
211211
E267E2171B84DB6E00BAB377 /* GIFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = E2B1BF321A85923800A999DF /* GIFunctions.m */; };
212212
E267E2181B84DB6E00BAB377 /* GIGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEA11A4D562300B6AF66 /* GIGraph.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
213213
E267E2191B84DB6E00BAB377 /* GIGraphView.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEA31A4D562300B6AF66 /* GIGraphView.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
214-
E267E21A1B84DB6E00BAB377 /* GILayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEB11A4D599200B6AF66 /* GILayer.m */; };
215-
E267E21B1B84DB6E00BAB377 /* GILine.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEAB1A4D587800B6AF66 /* GILine.m */; };
214+
E267E21A1B84DB6E00BAB377 /* GILayer.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEB11A4D599200B6AF66 /* GILayer.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
215+
E267E21B1B84DB6E00BAB377 /* GILine.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEAB1A4D587800B6AF66 /* GILine.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
216216
E267E21C1B84DB6E00BAB377 /* GINode.m in Sources */ = {isa = PBXBuildFile; fileRef = E2D4DEA71A4D57AA00B6AF66 /* GINode.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
217217
E267E21D1B84DB6E00BAB377 /* GIPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = E21A88F21A9471B300255AC3 /* GIPrivate.m */; };
218218
E267E21E1B84DB6E00BAB377 /* GISplitDiffView.m in Sources */ = {isa = PBXBuildFile; fileRef = E2891AB21AE15BB600E58C77 /* GISplitDiffView.m */; };

GitUpKit/Interface/GIBranch.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
#if __has_feature(objc_arc)
17+
#error This file requires MRC
18+
#endif
19+
1620
#import "GIPrivate.h"
1721

1822
@implementation GIBranch

GitUpKit/Interface/GILayer.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
#if __has_feature(objc_arc)
17+
#error This file requires MRC
18+
#endif
19+
1620
#import "GIPrivate.h"
1721

1822
@implementation GILayer {
@@ -33,14 +37,16 @@ - (instancetype)initWithIndex:(NSUInteger)index {
3337
- (void)dealloc {
3438
CFRelease(_lines);
3539
CFRelease(_nodes);
40+
41+
[super dealloc];
3642
}
3743

3844
- (NSArray*)nodes {
39-
return (__bridge NSArray*)_nodes;
45+
return (NSArray*)_nodes;
4046
}
4147

4248
- (NSArray*)lines {
43-
return (__bridge NSArray*)_lines;
49+
return (NSArray*)_lines;
4450
}
4551

4652
- (void)addNode:(GINode*)node {

GitUpKit/Interface/GILine.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
#if __has_feature(objc_arc)
17+
#error This file requires MRC
18+
#endif
19+
1620
#import "GIPrivate.h"
1721

1822
@implementation GILine {
@@ -30,11 +34,16 @@ - (instancetype)initWithBranch:(GIBranch*)branch {
3034
}
3135

3236
- (void)dealloc {
37+
#if __GI_HAS_APPKIT__
38+
[_color release];
39+
#endif
3340
CFRelease(_nodes);
41+
42+
[super dealloc];
3443
}
3544

3645
- (NSArray*)nodes {
37-
return (__bridge NSArray*)_nodes;
46+
return (NSArray*)_nodes;
3847
}
3948

4049
- (void)addNode:(GINode*)node {

0 commit comments

Comments
 (0)