diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-08-24 15:45:19 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-08-24 15:45:19 +0000 |
commit | e6dabdd700a9c4b76e66bb6e7cc8beca3bd1aeeb (patch) | |
tree | 4cddedf5d8dcfafa983ca425a44602a2e17c386b | |
parent | 0f017ffd481523a46e1ef8c14db1e6a1e290ed3b (diff) |
[Author: dmaclach]
Standardize how we call free. No need to check for NULL.
R=thomasvl
DELTA=24 (0 added, 13 deleted, 11 changed)
-rw-r--r-- | DebugUtils/GTMMethodCheck.m | 8 | ||||
-rw-r--r-- | Foundation/GTMLoggerRingBufferWriter.m | 4 | ||||
-rw-r--r-- | Foundation/GTMRegex.m | 13 | ||||
-rw-r--r-- | Foundation/GTMStackTrace.m | 10 |
4 files changed, 11 insertions, 24 deletions
diff --git a/DebugUtils/GTMMethodCheck.m b/DebugUtils/GTMMethodCheck.m index a8c4ae3..0d55e11 100644 --- a/DebugUtils/GTMMethodCheck.m +++ b/DebugUtils/GTMMethodCheck.m @@ -151,13 +151,9 @@ void GTMMethodCheckMethodChecker(void) { } } } - if (methods) { - free(methods); - } - } - if (classes) { - free(classes); + free(methods); } + free(classes); [pool release]; } diff --git a/Foundation/GTMLoggerRingBufferWriter.m b/Foundation/GTMLoggerRingBufferWriter.m index 4a8c7c6..9d1c63f 100644 --- a/Foundation/GTMLoggerRingBufferWriter.m +++ b/Foundation/GTMLoggerRingBufferWriter.m @@ -88,9 +88,7 @@ typedef void (GTMRingBufferPairCallback)(GTMLoggerRingBufferWriter *rbw, [self reset]; [writer_ release]; - if (buffer_) { - free(buffer_); - } + free(buffer_); [super dealloc]; diff --git a/Foundation/GTMRegex.m b/Foundation/GTMRegex.m index 1027224..4c393a6 100644 --- a/Foundation/GTMRegex.m +++ b/Foundation/GTMRegex.m @@ -514,10 +514,7 @@ static NSString *const kReplacementPattern = // Don't need a finalize because savedRegMatches_ is marked __strong - (void)dealloc { - if (savedRegMatches_) { - free(savedRegMatches_); - savedRegMatches_ = nil; - } + free(savedRegMatches_); [regex_ release]; [utf8StrBuf_ release]; [super dealloc]; @@ -656,8 +653,7 @@ static NSString *const kReplacementPattern = } @catch (id e) { // COV_NF_START - no real way to force this in a test _GTMDevLog(@"Exceptions while trying to advance enumeration (%@)", e); // if we still have something in our temp, free it - if (nextMatches) - free(nextMatches); + free(nextMatches); } // COV_NF_END return result; @@ -685,10 +681,7 @@ static NSString *const kReplacementPattern = } - (void)dealloc { - if (regMatches_) { - free(regMatches_); - regMatches_ = nil; - } + free(regMatches_); [utf8StrBuf_ release]; [super dealloc]; } diff --git a/Foundation/GTMStackTrace.m b/Foundation/GTMStackTrace.m index 05843b5..1c7bafb 100644 --- a/Foundation/GTMStackTrace.m +++ b/Foundation/GTMStackTrace.m @@ -261,7 +261,7 @@ NSUInteger GTMGetStackAddressDescriptors(struct GTMAddressDescriptor outDescs[], // Fill in the desc structures result = GTMGetStackAddressDescriptorsForAddresses(pcs, outDescs, addrCount); } - if (pcs) free(pcs); + free(pcs); } #endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 @@ -316,8 +316,8 @@ NSString *GTMStackTrace(void) { (count - kTracesToStrip)); } } - if (pcs) free(pcs); - if (descs) free(descs); + free(pcs); + free(descs); } #endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 @@ -348,8 +348,8 @@ NSString *GTMStackTraceFromException(NSException *e) { // Build the trace trace = GTMStackTraceFromAddressDescriptors(descs, count); } - if (pcs) free(pcs); - if (descs) free(descs); + free(pcs); + free(descs); } return trace; |