Permalink
Browse files

Switching to ARC (automatic reference counting)

  • Loading branch information...
1 parent 8bf1951 commit db4785329b58d9e146520041691f7085b08d0ad9 @robbiehanson robbiehanson committed Nov 10, 2011
Showing with 3,899 additions and 2,211 deletions.
  1. +20 −23 Benchmarking/PerformanceTesting.m
  2. +0 −1 Lumberjack/DDASLLogger.m
  3. +62 −76 Lumberjack/DDAbstractDatabaseLogger.m
  4. +12 −12 Lumberjack/DDFileLogger.h
  5. +26 −83 Lumberjack/DDFileLogger.m
  6. +49 −95 Lumberjack/DDLog.m
  7. +0 −1 Lumberjack/DDTTYLogger.m
  8. +0 −15 Lumberjack/Extensions/ContextFilterLogFormatter.m
  9. +4 −10 Lumberjack/Extensions/DispatchQueueLogFormatter.m
  10. +4 −0 Xcode/BenchmarkIPhone/BenchmarkIPhone.xcodeproj/project.pbxproj
  11. +2 −2 Xcode/BenchmarkIPhone/Classes/BenchmarkIPhoneAppDelegate.h
  12. +0 −6 Xcode/BenchmarkIPhone/Classes/BenchmarkIPhoneAppDelegate.m
  13. +0 −3 Xcode/BenchmarkIPhone/Classes/BenchmarkIPhoneViewController.m
  14. +4 −4 Xcode/BenchmarkIPhone/main.m
  15. +61 −24 Xcode/BenchmarkMac/BenchmarkMac.xcodeproj/project.pbxproj
  16. +2 −2 Xcode/BenchmarkMac/BenchmarkMacAppDelegate.h
  17. +8 −2 Xcode/ContextFilter/ContextFilter.xcodeproj/project.pbxproj
  18. +2 −2 Xcode/ContextFilter/ContextFilterAppDelegate.h
  19. +1 −1 Xcode/ContextFilter/ContextFilterAppDelegate.m
  20. +6 −0 Xcode/CoreDataLogger/CoreDataLogger.xcodeproj/project.pbxproj
  21. +2 −2 Xcode/CoreDataLogger/CoreDataLogger/CoreDataLogger.h
  22. +32 −47 Xcode/CoreDataLogger/CoreDataLogger/CoreDataLogger.m
  23. +2 −2 Xcode/CoreDataLogger/CoreDataLogger/CoreDataLoggerAppDelegate.h
  24. +4 −4 Xcode/CoreDataLogger/CoreDataLogger/LogEntry.h
  25. +11 −7 Xcode/CustomFormatters/CustomFormatters.xcodeproj/project.pbxproj
  26. +2 −2 Xcode/CustomFormatters/CustomFormattersAppDelegate.h
  27. +1 −1 Xcode/CustomFormatters/CustomFormattersAppDelegate.m
  28. +11 −7 Xcode/CustomLogLevels/CustomLogLevels.xcodeproj/project.pbxproj
  29. +2 −2 Xcode/CustomLogLevels/CustomLogLevelsAppDelegate.h
  30. +8 −8 Xcode/CustomLogLevels/MYLog.h
  31. +3 −0 Xcode/DispatchQueueLogger/DispatchQueueLogger.xcodeproj/project.pbxproj
  32. +1 −1 Xcode/DispatchQueueLogger/DispatchQueueLogger/AppDelegate.h
  33. +1 −1 Xcode/DispatchQueueLogger/DispatchQueueLogger/AppDelegate.m
  34. +11 −7 Xcode/FineGrainedLogging/FineGrainedLogging.xcodeproj/project.pbxproj
  35. +2 −2 Xcode/FineGrainedLogging/FineGrainedLoggingAppDelegate.h
  36. +4 −7 Xcode/FineGrainedLogging/TimerOne.m
  37. +4 −7 Xcode/FineGrainedLogging/TimerTwo.m
  38. +11 −7 Xcode/GlobalLogLevel/GlobalLogLevel.xcodeproj/project.pbxproj
  39. +2 −2 Xcode/GlobalLogLevel/GlobalLogLevelAppDelegate.h
  40. +17 −27 Xcode/LogFileCompressor/CompressingLogFileManager.m
  41. +11 −7 Xcode/LogFileCompressor/LogFileCompressor.xcodeproj/project.pbxproj
  42. +2 −2 Xcode/LogFileCompressor/LogFileCompressorAppDelegate.h
  43. +1 −1 Xcode/LogFileCompressor/LogFileCompressorAppDelegate.m
  44. +11 −7 Xcode/OverflowTestMac/OverflowTestMac.xcodeproj/project.pbxproj
  45. +2 −2 Xcode/OverflowTestMac/OverflowTestMacAppDelegate.h
  46. +15 −15 Xcode/OverflowTestMac/OverflowTestMacAppDelegate.m
  47. +11 −7 Xcode/RollingTestMac/RollingTestMac.xcodeproj/project.pbxproj
  48. +2 −2 Xcode/RollingTestMac/RollingTestMacAppDelegate.h
  49. +2 −22 Xcode/SQLiteLogger/FMDBLogger.m
  50. +6 −3 Xcode/SQLiteLogger/SQLiteLogger.xcodeproj/project.pbxproj
  51. +2 −2 Xcode/SQLiteLogger/SQLiteLogger/SQLiteLoggerAppDelegate.h
  52. +64 −34 ...DynamicLogging/Desktop/{RegisteredLoggingTest → }/RegisteredLoggingTest.xcodeproj/project.pbxproj
  53. 0 ...Testing/RegisteredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/Lions.h
  54. 0 ...Testing/RegisteredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/Lions.m
  55. 0 ...Logging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTest-Info.plist
  56. 0 ...Logging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTest-Prefix.pch
  57. +0 −7 ...egisteredLoggingTest/RegisteredLoggingTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  58. +2 −2 ...gging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestAppDelegate.h
  59. 0 ...gging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestAppDelegate.m
  60. 0 ...esting/RegisteredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/Tigers.h
  61. 0 ...esting/RegisteredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/Tigers.m
  62. 0 ...teredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/Credits.rtf
  63. 0 ...ynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/InfoPlist.strings
  64. 0 ...eredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/MainMenu.xib
  65. 0 .../Testing/RegisteredDynamicLogging/Desktop/RegisteredLoggingTest/{RegisteredLoggingTest → }/main.m
  66. +63 −34 ...dDynamicLogging/Mobile/{RegisteredLoggingTest → }/RegisteredLoggingTest.xcodeproj/project.pbxproj
  67. 0 .../Testing/RegisteredDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/Lions.h
  68. 0 .../Testing/RegisteredDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/Lions.m
  69. 0 ...cLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTest-Info.plist
  70. 0 ...cLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTest-Prefix.pch
  71. +0 −7 ...egisteredLoggingTest/RegisteredLoggingTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  72. +2 −2 ...ogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestAppDelegate.h
  73. 0 ...ogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestAppDelegate.m
  74. 0 ...ing/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestViewController.h
  75. 0 ...ing/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/RegisteredLoggingTestViewController.m
  76. 0 ...Testing/RegisteredDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/Tigers.h
  77. 0 ...Testing/RegisteredDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/Tigers.m
  78. 0 ...DynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/InfoPlist.strings
  79. 0 ...redDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/MainWindow.xib
  80. 0 ...RegisteredLoggingTest/{RegisteredLoggingTest → }/en.lproj/RegisteredLoggingTestViewController.xib
  81. +4 −4 ...e/Testing/RegisteredDynamicLogging/Mobile/RegisteredLoggingTest/{RegisteredLoggingTest → }/main.m
  82. +2 −2 Xcode/UniversalApp/Classes/UniversalAppAppDelegate.h
  83. +0 −5 Xcode/UniversalApp/Classes/UniversalAppAppDelegate.m
  84. +0 −3 Xcode/UniversalApp/Classes/UniversalAppViewController.m
  85. +6 −2 Xcode/UniversalApp/UniversalApp.xcodeproj/project.pbxproj
  86. +4 −4 Xcode/UniversalApp/main.m
  87. +8 −7 Xcode/WebServerIPhone/Classes/MyHTTPConnection.m
  88. +4 −5 Xcode/WebServerIPhone/Classes/WebServerIPhoneAppDelegate.h
  89. +0 −6 Xcode/WebServerIPhone/Classes/WebServerIPhoneAppDelegate.m
  90. +0 −4 Xcode/WebServerIPhone/Classes/WebServerIPhoneViewController.m
  91. +5 −12 Xcode/WebServerIPhone/Classes/WebSocketLogger.m
  92. +140 −59 Xcode/WebServerIPhone/Vendor/{CocoaHTTPServer → CocoaAsyncSocket}/GCDAsyncSocket.h
  93. +2,167 −929 Xcode/WebServerIPhone/Vendor/{CocoaHTTPServer → CocoaAsyncSocket}/GCDAsyncSocket.m
  94. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDData.h
  95. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDData.m
  96. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDNumber.h
  97. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDNumber.m
  98. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDRange.h
  99. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Categories}/DDRange.m
  100. +10 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.h
  101. +558 −243 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPConnection.m
  102. +35 −22 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPLogging.h
  103. +52 −18 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPResponse.h
  104. +40 −1 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPServer.h
  105. +71 −39 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/HTTPServer.m
  106. +0 −18 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/LICENSE.txt
  107. +2 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPAsyncFileResponse.h
  108. +3 −3 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPAsyncFileResponse.m
  109. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPDataResponse.h
  110. +1 −1 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPDataResponse.m
  111. +4 −0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPDynamicFileResponse.h
  112. +8 −8 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPDynamicFileResponse.m
  113. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPFileResponse.h
  114. +2 −2 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPFileResponse.m
  115. 0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPRedirectResponse.h
  116. +1 −1 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/{ → Responses}/HTTPRedirectResponse.m
  117. +2 −0 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.h
  118. +9 −6 Xcode/WebServerIPhone/Vendor/CocoaHTTPServer/WebSocket.m
  119. +167 −138 Xcode/WebServerIPhone/WebServerIPhone.xcodeproj/project.pbxproj
  120. +4 −4 Xcode/WebServerIPhone/main.m
@@ -122,37 +122,34 @@ + (void)executeTestsWithBase:(BOOL)exeBase framework:(BOOL)exeFramework framewor
for (j = 0; j < 5; j++)
{
- SEL selector;
- switch (j)
- {
- case 0 : selector = @selector(speedTest0); break;
- case 1 : selector = @selector(speedTest1); break;
- case 2 : selector = @selector(speedTest2); break;
- case 3 : selector = @selector(speedTest3); break;
- default : selector = @selector(speedTest4); break;
- }
-
NSTimeInterval min = DBL_MAX;
NSTimeInterval max = DBL_MIN;
NSTimeInterval total = 0.0;
for (k = 0; k < NUMBER_OF_RUNS; k++)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- NSDate *start = [NSDate date];
-
- [class performSelector:selector];
-
- NSTimeInterval result = [start timeIntervalSinceNow] * -1.0;
-
- min = MIN(min, result);
- max = MAX(max, result);
+ @autoreleasepool {
- total += result;
+ NSDate *start = [NSDate date];
+
+ switch (j)
+ {
+ case 0 : [class performSelector:@selector(speedTest0)]; break;
+ case 1 : [class performSelector:@selector(speedTest1)]; break;
+ case 2 : [class performSelector:@selector(speedTest2)]; break;
+ case 3 : [class performSelector:@selector(speedTest3)]; break;
+ default : [class performSelector:@selector(speedTest4)]; break;
+ }
+
+ NSTimeInterval result = [start timeIntervalSinceNow] * -1.0;
+
+ min = MIN(min, result);
+ max = MAX(max, result);
+
+ total += result;
- [pool release];
+ }
[DDLog flushLog];
}
@@ -319,7 +316,7 @@ + (NSString *)csvResults
+ (void)startPerformanceTests
{
- BOOL runBase = YES;
+ BOOL runBase = NO;
BOOL runSuite1 = YES;
BOOL runSuite2 = YES;
BOOL runSuite3 = YES;
View
@@ -35,7 +35,6 @@ - (id)init
{
if (sharedInstance != nil)
{
- [self release];
return nil;
}
@@ -26,7 +26,6 @@ - (void)dealloc
[self destroySaveTimer];
[self destroyDeleteTimer];
- [super dealloc];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -129,13 +128,11 @@ - (void)createSuspendedSaveTimer
{
saveTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
- dispatch_source_set_event_handler(saveTimer, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_source_set_event_handler(saveTimer, ^{ @autoreleasepool {
[self performSaveAndSuspendSaveTimer];
- [pool drain];
- });
+ }});
saveTimerSuspended = YES;
}
@@ -173,13 +170,11 @@ - (void)createAndStartDeleteTimer
{
deleteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, loggerQueue);
- dispatch_source_set_event_handler(deleteTimer, ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_source_set_event_handler(deleteTimer, ^{ @autoreleasepool {
[self performDelete];
- [pool drain];
- });
+ }});
[self updateDeleteTimer];
@@ -224,11 +219,11 @@ - (void)setSaveThreshold:(NSUInteger)threshold
if ((unsavedCount >= saveThreshold) && (saveThreshold > 0))
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- [self performSaveAndSuspendSaveTimer];
+ @autoreleasepool {
+
+ [self performSaveAndSuspendSaveTimer];
- [pool drain];
+ }
}
}
};
@@ -280,30 +275,29 @@ - (void)setSaveInterval:(NSTimeInterval)interval
if (saveInterval > 0.0)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if (saveTimer == NULL)
- {
- // Handles #2
- //
- // Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
- // if a save is needed the timer will fire immediately.
-
- [self createSuspendedSaveTimer];
- [self updateAndResumeSaveTimer];
- }
- else
+ @autoreleasepool
{
- // Handles #3
- // Handles #4
- //
- // Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
- // if a save is needed the timer will fire immediately.
-
- [self updateAndResumeSaveTimer];
+ if (saveTimer == NULL)
+ {
+ // Handles #2
+ //
+ // Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
+ // if a save is needed the timer will fire immediately.
+
+ [self createSuspendedSaveTimer];
+ [self updateAndResumeSaveTimer];
+ }
+ else
+ {
+ // Handles #3
+ // Handles #4
+ //
+ // Since the saveTimer uses the unsavedTime to calculate it's first fireDate,
+ // if a save is needed the timer will fire immediately.
+
+ [self updateAndResumeSaveTimer];
+ }
}
-
- [pool drain];
}
else if (saveTimer)
{
@@ -387,16 +381,15 @@ - (void)setMaxAge:(NSTimeInterval)interval
if (shouldDeleteNow)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- [self performDelete];
-
- if (deleteTimer)
- [self updateDeleteTimer];
- else
- [self createAndStartDeleteTimer];
-
- [pool drain];
+ @autoreleasepool
+ {
+ [self performDelete];
+
+ if (deleteTimer)
+ [self updateDeleteTimer];
+ else
+ [self createAndStartDeleteTimer];
+ }
}
}
};
@@ -448,29 +441,28 @@ - (void)setDeleteInterval:(NSTimeInterval)interval
if (deleteInterval > 0.0)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if (deleteTimer == NULL)
- {
- // Handles #2
- //
- // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
- // if a delete is needed the timer will fire immediately.
-
- [self createAndStartDeleteTimer];
- }
- else
+ @autoreleasepool
{
- // Handles #3
- // Handles #4
- //
- // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
- // if a save is needed the timer will fire immediately.
-
- [self updateDeleteTimer];
+ if (deleteTimer == NULL)
+ {
+ // Handles #2
+ //
+ // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
+ // if a delete is needed the timer will fire immediately.
+
+ [self createAndStartDeleteTimer];
+ }
+ else
+ {
+ // Handles #3
+ // Handles #4
+ //
+ // Since the deleteTimer uses the lastDeleteTime to calculate it's first fireDate,
+ // if a save is needed the timer will fire immediately.
+
+ [self updateDeleteTimer];
+ }
}
-
- [pool drain];
}
else if (deleteTimer)
{
@@ -524,13 +516,10 @@ - (void)setDeleteOnEverySave:(BOOL)flag
- (void)savePendingLogEntries
{
- dispatch_block_t block = ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_block_t block = ^{ @autoreleasepool {
[self performSaveAndSuspendSaveTimer];
-
- [pool drain];
- };
+ }};
if (dispatch_get_current_queue() == loggerQueue)
block();
@@ -540,13 +529,10 @@ - (void)savePendingLogEntries
- (void)deleteOldLogEntries
{
- dispatch_block_t block = ^{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ dispatch_block_t block = ^{ @autoreleasepool {
[self performDelete];
-
- [pool drain];
- };
+ }};
if (dispatch_get_current_queue() == loggerQueue)
block();
View
@@ -141,7 +141,7 @@
@interface DDFileLogger : DDAbstractLogger <DDLogger>
{
- id <DDLogFileManager> logFileManager;
+ __strong id <DDLogFileManager> logFileManager;
DDLogFileInfo *currentLogFileInfo;
NSFileHandle *currentLogFileHandle;
@@ -184,7 +184,7 @@
@property (readwrite, assign) NSTimeInterval rollingFrequency;
-@property (nonatomic, readonly) id <DDLogFileManager> logFileManager;
+@property (strong, nonatomic, readonly) id <DDLogFileManager> logFileManager;
// You can optionally force the current log file to be rolled with this method.
@@ -217,24 +217,24 @@
@interface DDLogFileInfo : NSObject
{
- NSString *filePath;
- NSString *fileName;
+ __strong NSString *filePath;
+ __strong NSString *fileName;
- NSDictionary *fileAttributes;
+ __strong NSDictionary *fileAttributes;
- NSDate *creationDate;
- NSDate *modificationDate;
+ __strong NSDate *creationDate;
+ __strong NSDate *modificationDate;
unsigned long long fileSize;
}
-@property (nonatomic, readonly) NSString *filePath;
-@property (nonatomic, readonly) NSString *fileName;
+@property (strong, nonatomic, readonly) NSString *filePath;
+@property (strong, nonatomic, readonly) NSString *fileName;
-@property (nonatomic, readonly) NSDictionary *fileAttributes;
+@property (strong, nonatomic, readonly) NSDictionary *fileAttributes;
-@property (nonatomic, readonly) NSDate *creationDate;
-@property (nonatomic, readonly) NSDate *modificationDate;
+@property (strong, nonatomic, readonly) NSDate *creationDate;
+@property (strong, nonatomic, readonly) NSDate *modificationDate;
@property (nonatomic, readonly) unsigned long long fileSize;
Oops, something went wrong.

0 comments on commit db47853

Please sign in to comment.