Skip to content

Commit e71f05c

Browse files
committed
Use the OS_OBJECT_USE_OBJC macro
1 parent cce9f80 commit e71f05c

File tree

3 files changed

+6
-82
lines changed

3 files changed

+6
-82
lines changed

Lumberjack/DDAbstractDatabaseLogger.m

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,6 @@
1515
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
1616
#endif
1717

18-
/**
19-
* Does ARC support support GCD objects?
20-
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
21-
**/
22-
#if TARGET_OS_IPHONE
23-
24-
// Compiling for iOS
25-
26-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
27-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
28-
#else // iOS 5.X or earlier
29-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
30-
#endif
31-
32-
#else
33-
34-
// Compiling for Mac OS X
35-
36-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
37-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
38-
#else
39-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
40-
#endif
41-
42-
#endif
43-
4418
@interface DDAbstractDatabaseLogger ()
4519
- (void)destroySaveTimer;
4620
- (void)destroyDeleteTimer;
@@ -147,7 +121,7 @@ - (void)destroySaveTimer
147121
dispatch_resume(saveTimer);
148122
saveTimerSuspended = NO;
149123
}
150-
#if NEEDS_DISPATCH_RETAIN_RELEASE
124+
#if !OS_OBJECT_USE_OBJC
151125
dispatch_release(saveTimer);
152126
#endif
153127
saveTimer = NULL;
@@ -192,7 +166,7 @@ - (void)destroyDeleteTimer
192166
if (deleteTimer)
193167
{
194168
dispatch_source_cancel(deleteTimer);
195-
#if NEEDS_DISPATCH_RETAIN_RELEASE
169+
#if !OS_OBJECT_USE_OBJC
196170
dispatch_release(deleteTimer);
197171
#endif
198172
deleteTimer = NULL;

Lumberjack/DDFileLogger.m

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,6 @@
1919
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
2020
#endif
2121

22-
// Does ARC support support GCD objects?
23-
// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
24-
25-
#if TARGET_OS_IPHONE
26-
27-
// Compiling for iOS
28-
29-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
30-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
31-
#else // iOS 5.X or earlier
32-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
33-
#endif
34-
35-
#else
36-
37-
// Compiling for Mac OS X
38-
39-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
40-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
41-
#else
42-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
43-
#endif
44-
45-
#endif
46-
4722
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
4823
// But we still want to leave our log statements for any future debugging,
4924
// and to allow other developers to trace the implementation (which is a great learning tool).
@@ -674,7 +649,7 @@ - (void)scheduleTimerToRollLogFileDueToAge
674649

675650
}});
676651

677-
#if NEEDS_DISPATCH_RETAIN_RELEASE
652+
#if !OS_OBJECT_USE_OBJC
678653
dispatch_source_t theRollingTimer = rollingTimer;
679654
dispatch_source_set_cancel_handler(rollingTimer, ^{
680655
dispatch_release(theRollingTimer);

Lumberjack/DDLog.m

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,6 @@
2222
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
2323
#endif
2424

25-
// Does ARC support support GCD objects?
26-
// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
27-
28-
#if TARGET_OS_IPHONE
29-
30-
// Compiling for iOS
31-
32-
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
33-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
34-
#else // iOS 5.X or earlier
35-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
36-
#endif
37-
38-
#else
39-
40-
// Compiling for Mac OS X
41-
42-
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
43-
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
44-
#else
45-
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
46-
#endif
47-
48-
#endif
49-
5025
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
5126
// But we still want to leave our log statements for any future debugging,
5227
// and to allow other developers to trace the implementation (which is a great learning tool).
@@ -805,7 +780,7 @@ - (id)initWithLogger:(id <DDLogger>)aLogger loggerQueue:(dispatch_queue_t)aLogge
805780

806781
if (aLoggerQueue) {
807782
loggerQueue = aLoggerQueue;
808-
#if NEEDS_DISPATCH_RETAIN_RELEASE
783+
#if !OS_OBJECT_USE_OBJC
809784
dispatch_retain(loggerQueue);
810785
#endif
811786
}
@@ -820,7 +795,7 @@ + (DDLoggerNode *)nodeWithLogger:(id <DDLogger>)logger loggerQueue:(dispatch_que
820795

821796
- (void)dealloc
822797
{
823-
#if NEEDS_DISPATCH_RETAIN_RELEASE
798+
#if !OS_OBJECT_USE_OBJC
824799
if (loggerQueue) dispatch_release(loggerQueue);
825800
#endif
826801
}
@@ -977,7 +952,7 @@ - (id)init
977952

978953
- (void)dealloc
979954
{
980-
#if NEEDS_DISPATCH_RETAIN_RELEASE
955+
#if !OS_OBJECT_USE_OBJC
981956
if (loggerQueue) dispatch_release(loggerQueue);
982957
#endif
983958
}

0 commit comments

Comments
 (0)