Permalink
Browse files

Merge pull request #93 from mattjgalloway/Use_OS_OBJECT_USE_OBJC

Use the OS_OBJECT_USE_OBJC macro
  • Loading branch information...
2 parents c697669 + e71f05c commit 568bc7bb4a9c01e86f78d4714170bc6ba742c297 @robbiehanson robbiehanson committed Mar 24, 2013
Showing with 6 additions and 82 deletions.
  1. +2 −28 Lumberjack/DDAbstractDatabaseLogger.m
  2. +1 −26 Lumberjack/DDFileLogger.m
  3. +3 −28 Lumberjack/DDLog.m
@@ -15,32 +15,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-/**
- * Does ARC support support GCD objects?
- * It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-**/
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
@interface DDAbstractDatabaseLogger ()
- (void)destroySaveTimer;
- (void)destroyDeleteTimer;
@@ -147,7 +121,7 @@ - (void)destroySaveTimer
dispatch_resume(saveTimer);
saveTimerSuspended = NO;
}
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(saveTimer);
#endif
saveTimer = NULL;
@@ -192,7 +166,7 @@ - (void)destroyDeleteTimer
if (deleteTimer)
{
dispatch_source_cancel(deleteTimer);
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(deleteTimer);
#endif
deleteTimer = NULL;
@@ -19,31 +19,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-// Does ARC support support GCD objects?
-// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
// But we still want to leave our log statements for any future debugging,
// and to allow other developers to trace the implementation (which is a great learning tool).
@@ -674,7 +649,7 @@ - (void)scheduleTimerToRollLogFileDueToAge
}});
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_source_t theRollingTimer = rollingTimer;
dispatch_source_set_cancel_handler(rollingTimer, ^{
dispatch_release(theRollingTimer);
View
@@ -22,31 +22,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
-// Does ARC support support GCD objects?
-// It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
-
-#if TARGET_OS_IPHONE
-
- // Compiling for iOS
-
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else // iOS 5.X or earlier
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1
- #endif
-
-#else
-
- // Compiling for Mac OS X
-
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
- #define NEEDS_DISPATCH_RETAIN_RELEASE 0
- #else
- #define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
- #endif
-
-#endif
-
// We probably shouldn't be using DDLog() statements within the DDLog implementation.
// But we still want to leave our log statements for any future debugging,
// 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
if (aLoggerQueue) {
loggerQueue = aLoggerQueue;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_retain(loggerQueue);
#endif
}
@@ -820,7 +795,7 @@ + (DDLoggerNode *)nodeWithLogger:(id <DDLogger>)logger loggerQueue:(dispatch_que
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (loggerQueue) dispatch_release(loggerQueue);
#endif
}
@@ -977,7 +952,7 @@ - (id)init
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (loggerQueue) dispatch_release(loggerQueue);
#endif
}

0 comments on commit 568bc7b

Please sign in to comment.