diff options
35 files changed, 223 insertions, 249 deletions
diff --git a/Source/SPActivityTextFieldCell.m b/Source/SPActivityTextFieldCell.m index b82fa995..b09454bb 100644 --- a/Source/SPActivityTextFieldCell.m +++ b/Source/SPActivityTextFieldCell.m @@ -327,7 +327,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) if(activityName) SPClear(activityName); if(activityInfo) SPClear(activityInfo); if(contextInfo) SPClear(contextInfo); - if(cancelButton) [cancelButton release]; + if(cancelButton) SPClear(cancelButton); [super dealloc]; } diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 87cf9f24..0840978d 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -2231,14 +2231,14 @@ { [[NSNotificationCenter defaultCenter] removeObserver:self]; - if (bundleItems) [bundleItems release]; - if (bundleUsedScopes) [bundleUsedScopes release]; - if (bundleHTMLOutputController) [bundleHTMLOutputController release]; - if (bundleCategories) [bundleCategories release]; - if (bundleTriggers) [bundleTriggers release]; - if (bundleKeyEquivalents) [bundleKeyEquivalents release]; - if (installedBundleUUIDs) [installedBundleUUIDs release]; - if (runningActivitiesArray) [runningActivitiesArray release]; + if (bundleItems) SPClear(bundleItems); + if (bundleUsedScopes) SPClear(bundleUsedScopes); + if (bundleHTMLOutputController) SPClear(bundleHTMLOutputController); + if (bundleCategories) SPClear(bundleCategories); + if (bundleTriggers) SPClear(bundleTriggers); + if (bundleKeyEquivalents) SPClear(bundleKeyEquivalents); + if (installedBundleUUIDs) SPClear(installedBundleUUIDs); + if (runningActivitiesArray) SPClear(runningActivitiesArray); SPClear(prefsController); diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m index 9a2d2ba8..f8d4e53f 100644 --- a/Source/SPBundleCommandTextView.m +++ b/Source/SPBundleCommandTextView.m @@ -40,8 +40,8 @@ { [[NSNotificationCenter defaultCenter] removeObserver:self]; [prefs removeObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth]; - [prefs release]; - [lineNumberView release]; + SPClear(prefs); + SPClear(lineNumberView); [super dealloc]; } diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 69652bf1..01aca387 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -1090,8 +1090,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; // Remove temporary drag file if any if(draggedFilePath) { [[NSFileManager defaultManager] removeItemAtPath:draggedFilePath error:nil]; - [draggedFilePath release]; - draggedFilePath = nil; + SPClear(draggedFilePath); } if(oldBundleName) SPClear(oldBundleName); } @@ -1478,8 +1477,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; // Remove old temporary drag file if any if(draggedFilePath) { [[NSFileManager defaultManager] removeItemAtPath:draggedFilePath error:nil]; - [draggedFilePath release]; - draggedFilePath = nil; + SPClear(draggedFilePath); } NSImage *dragImage; @@ -2074,33 +2072,33 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; - (void)dealloc { - [inputGeneralScopePopUpMenu release]; - [inputInputFieldScopePopUpMenu release]; - [inputDataTableScopePopUpMenu release]; - [outputGeneralScopePopUpMenu release]; - [outputInputFieldScopePopUpMenu release]; - [outputDataTableScopePopUpMenu release]; - [inputFallbackInputFieldScopePopUpMenu release]; - [triggerInputFieldPopUpMenu release]; - [triggerDataTablePopUpMenu release]; - [triggerGeneralPopUpMenu release]; - [withBlobDataTablePopUpMenu release]; - [inputNonePopUpMenu release]; + SPClear(inputGeneralScopePopUpMenu); + SPClear(inputInputFieldScopePopUpMenu); + SPClear(inputDataTableScopePopUpMenu); + SPClear(outputGeneralScopePopUpMenu); + SPClear(outputInputFieldScopePopUpMenu); + SPClear(outputDataTableScopePopUpMenu); + SPClear(inputFallbackInputFieldScopePopUpMenu); + SPClear(triggerInputFieldPopUpMenu); + SPClear(triggerDataTablePopUpMenu); + SPClear(triggerGeneralPopUpMenu); + SPClear(withBlobDataTablePopUpMenu); + SPClear(inputNonePopUpMenu); - [inputGeneralScopeArray release]; - [inputInputFieldScopeArray release]; - [inputDataTableScopeArray release]; - [outputGeneralScopeArray release]; - [outputInputFieldScopeArray release]; - [outputDataTableScopeArray release]; - [inputFallbackInputFieldScopeArray release]; - [triggerInputFieldArray release]; - [triggerDataTableArray release]; - [triggerGeneralArray release]; - [withBlobDataTableArray release]; + SPClear(inputGeneralScopeArray); + SPClear(inputInputFieldScopeArray); + SPClear(inputDataTableScopeArray); + SPClear(outputGeneralScopeArray); + SPClear(outputInputFieldScopeArray); + SPClear(outputDataTableScopeArray); + SPClear(inputFallbackInputFieldScopeArray); + SPClear(triggerInputFieldArray); + SPClear(triggerDataTableArray); + SPClear(triggerGeneralArray); + SPClear(withBlobDataTableArray); - [shellVariableSuggestions release]; - [deletedDefaultBundles release]; + SPClear(shellVariableSuggestions); + SPClear(deletedDefaultBundles); if (touchedBundleArray) SPClear(touchedBundleArray); if (commandBundleTree) SPClear(commandBundleTree); diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index ed1142a2..16a2f9da 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -126,7 +126,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; - (void)dealloc { - if(webPreferences) [webPreferences release]; + if(webPreferences) SPClear(webPreferences); [super dealloc]; } diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m index 88a2fbb5..819c34b7 100644 --- a/Source/SPCSVParser.m +++ b/Source/SPCSVParser.m @@ -650,17 +650,17 @@ return self; } - (void) dealloc { - [csvString release]; - [fieldEndString release]; - [lineEndString release]; - [fieldQuoteString release]; - [escapeString release]; - [escapedFieldEndString release]; - [escapedLineEndString release]; - [escapedFieldQuoteString release]; - [escapedEscapeString release]; - if (nullReplacementString) [nullReplacementString release]; - if (skipCharacterSet) [skipCharacterSet release]; + SPClear(csvString); + SPClear(fieldEndString); + SPClear(lineEndString); + SPClear(fieldQuoteString); + SPClear(escapeString); + SPClear(escapedFieldEndString); + SPClear(escapedLineEndString); + SPClear(escapedFieldQuoteString); + SPClear(escapedEscapeString); + if (nullReplacementString) SPClear(nullReplacementString); + if (skipCharacterSet) SPClear(skipCharacterSet); [super dealloc]; } diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m index 60b9ced3..8b7bf650 100644 --- a/Source/SPChooseMenuItemDialog.m +++ b/Source/SPChooseMenuItemDialog.m @@ -174,7 +174,7 @@ - (void)dealloc { - [dummyTextView release]; + SPClear(dummyTextView); [super dealloc]; } diff --git a/Source/SPColorSelectorView.m b/Source/SPColorSelectorView.m index 15b18596..f2eade86 100644 --- a/Source/SPColorSelectorView.m +++ b/Source/SPColorSelectorView.m @@ -424,7 +424,7 @@ enum trackingAreaIDs // ------------------------------------------------------------------------------- - (void)dealloc { - [trackingAreas release]; + SPClear(trackingAreas); [super dealloc]; } diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 651d3538..79a15a19 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -317,8 +317,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // Cancel the SSH tunnel if present if (sshTunnel) { [sshTunnel disconnect]; - [sshTunnel release]; - sshTunnel = nil; + SPClear(sshTunnel); } #ifndef SP_CODA @@ -1848,7 +1847,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, mySQLConnection = nil; } - if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], [sshTunnel disconnect], [sshTunnel release]; + if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], SPClear(sshTunnel); } #pragma mark - @@ -1883,9 +1882,9 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, #endif #ifndef SP_CODA - [keychain release]; + SPClear(keychain); #endif - [prefs release]; + SPClear(prefs); #ifndef SP_CODA SPClear(folderImage); @@ -1895,13 +1894,13 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, for (id retainedObject in nibObjectsToRelease) [retainedObject release]; - [nibObjectsToRelease release]; + SPClear(nibObjectsToRelease); - if (connectionKeychainID) [connectionKeychainID release]; - if (connectionKeychainItemName) [connectionKeychainItemName release]; - if (connectionKeychainItemAccount) [connectionKeychainItemAccount release]; - if (connectionSSHKeychainItemName) [connectionSSHKeychainItemName release]; - if (connectionSSHKeychainItemAccount) [connectionSSHKeychainItemAccount release]; + if (connectionKeychainID) SPClear(connectionKeychainID); + if (connectionKeychainItemName) SPClear(connectionKeychainItemName); + if (connectionKeychainItemAccount) SPClear(connectionKeychainItemAccount); + if (connectionSSHKeychainItemName) SPClear(connectionSSHKeychainItemName); + if (connectionSSHKeychainItemAccount) SPClear(connectionSSHKeychainItemAccount); #ifndef SP_CODA if (currentFavorite) SPClear(currentFavorite); diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index e35fd672..a8e747e2 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -975,7 +975,7 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; - (void)dealloc { - [contentFilters release]; + SPClear(contentFilters); [super dealloc]; } diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 7aaae1a6..7f25d05f 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -1539,9 +1539,9 @@ static const NSInteger kBlobAsImageFile = 4; - (void)dealloc { - if (columnDefinitions) [columnDefinitions release]; + if (columnDefinitions) SPClear(columnDefinitions); #ifndef SP_CODA - [prefs release]; + SPClear(prefs); #endif [super dealloc]; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 2114d766..8b3897fe 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1465,8 +1465,7 @@ { if (queryLoadTimer) { [queryLoadTimer invalidate]; - [queryLoadTimer release]; - queryLoadTimer = nil; + SPClear(queryLoadTimer); } } @@ -2153,8 +2152,7 @@ // this is the same as saying (isDesc && !invert) || (!isDesc && invert) if (isDesc != invert) { - [sortField release]; - sortField = nil; + SPClear(sortField); } else { isDesc = !isDesc; } @@ -3681,8 +3679,7 @@ } if(fieldEditor) { - [fieldEditor release]; - fieldEditor = nil; + SPClear(fieldEditor); } // Preserve focus and restore selection indexes if appropriate @@ -4036,22 +4033,22 @@ [NSObject cancelPreviousPerformRequestsWithTarget:customQueryView]; [self clearQueryLoadTimer]; - [resultLoadingCondition release]; - [usedQuery release]; - [lastExecutedQuery release]; - [resultData release]; - [favoritesManager release]; + SPClear(resultLoadingCondition); + SPClear(usedQuery); + SPClear(lastExecutedQuery); + SPClear(resultData); + SPClear(favoritesManager); if(fieldEditor) SPClear(fieldEditor); #ifndef SP_CODA - if (helpHTMLTemplate) [helpHTMLTemplate release]; + if (helpHTMLTemplate) SPClear(helpHTMLTemplate); #endif - if (mySQLversion) [mySQLversion release]; - if (sortField) [sortField release]; - if (cqColumnDefinition) [cqColumnDefinition release]; - if (selectionIndexToRestore) [selectionIndexToRestore release]; - if (currentQueryRanges) [currentQueryRanges release]; + if (mySQLversion) SPClear(mySQLversion); + if (sortField) SPClear(sortField); + if (cqColumnDefinition) SPClear(cqColumnDefinition); + if (selectionIndexToRestore) SPClear(selectionIndexToRestore); + if (currentQueryRanges) SPClear(currentQueryRanges); [super dealloc]; } diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index be3935c4..30ef3bf4 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -312,7 +312,7 @@ // Reset progress cancelled from any previous runs progressCancelled = NO; - if (lastFilename) [lastFilename release]; lastFilename = nil; + if (lastFilename) SPClear(lastFilename); lastFilename = [[NSString stringWithString:[[openPanel URL] path]] retain]; @@ -1728,21 +1728,20 @@ cleanup: - (void)dealloc { - if (fieldMappingImportArray) [fieldMappingImportArray release]; - if (geometryFields) [geometryFields release]; - if (geometryFieldsMapIndex) [geometryFieldsMapIndex release]; - if (bitFields) [bitFields release]; - if (nullableNumericFields) [nullableNumericFields release]; - if (bitFieldsMapIndex) [bitFieldsMapIndex release]; - if (nullableNumericFieldsMapIndex) [nullableNumericFieldsMapIndex release]; - - if (lastFilename) [lastFilename release]; - if (prefs) [prefs release]; - if(selectedTableTarget) [selectedTableTarget release]; + if (fieldMappingImportArray) SPClear(fieldMappingImportArray); + if (geometryFields) SPClear(geometryFields); + if (geometryFieldsMapIndex) SPClear(geometryFieldsMapIndex); + if (bitFields) SPClear(bitFields); + if (nullableNumericFields) SPClear(nullableNumericFields); + if (bitFieldsMapIndex) SPClear(bitFieldsMapIndex); + if (nullableNumericFieldsMapIndex) SPClear(nullableNumericFieldsMapIndex); + if (lastFilename) SPClear(lastFilename); + if (prefs) SPClear(prefs); + if (selectedTableTarget) SPClear(selectedTableTarget); for (id retainedObject in nibObjectsToRelease) [retainedObject release]; - [nibObjectsToRelease release]; + SPClear(nibObjectsToRelease); [super dealloc]; } diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index ab8eafc6..a0a6bf1c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -569,8 +569,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; if (queryEditorInitString && [queryEditorInitString length]) { [self viewQuery:self]; [customQueryInstance doPerformLoadQueryService:queryEditorInitString]; - [queryEditorInitString release]; - queryEditorInitString = nil; + SPClear(queryEditorInitString); } if (spfSession != nil) { diff --git a/Source/SPDatabaseStructure.m b/Source/SPDatabaseStructure.m index b34522c5..2eab3562 100644 --- a/Source/SPDatabaseStructure.m +++ b/Source/SPDatabaseStructure.m @@ -567,7 +567,7 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; [self destroy:nil]; - [structureRetrievalThreads release]; + SPClear(structureRetrievalThreads); pthread_mutex_destroy(&threadManagementLock); pthread_mutex_destroy(&dataLock); @@ -630,8 +630,7 @@ } pthread_mutex_unlock(&threadManagementLock); - [mySQLConnection release]; - mySQLConnection = nil; + SPClear(mySQLConnection); } // Create a copy of the supplied connection diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index c223faf4..4f34a998 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -169,14 +169,14 @@ } #endif - if ( sheetEditData ) [sheetEditData release]; + if ( sheetEditData ) SPClear(sheetEditData); #ifndef SP_CODA - if ( qlTypes ) [qlTypes release]; + if ( qlTypes ) SPClear(qlTypes); #endif - if ( tmpFileName ) [tmpFileName release]; - if ( tmpDirPath ) [tmpDirPath release]; - if ( esUndoManager ) [esUndoManager release]; - if ( contextInfo ) [contextInfo release]; + if ( tmpFileName ) SPClear(tmpFileName); + if ( tmpDirPath ) SPClear(tmpDirPath); + if ( esUndoManager ) SPClear(esUndoManager); + if ( contextInfo ) SPClear(contextInfo); [super dealloc]; } @@ -1078,8 +1078,6 @@ image = [[[NSImage alloc] initWithPasteboard:[NSPasteboard generalPasteboard]] autorelease]; if (image) { - if (nil != sheetEditData) [sheetEditData release]; - [editImage setImage:image]; if( sheetEditData ) [sheetEditData release]; diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m index 58350443..62204252 100644 --- a/Source/SPFileHandle.m +++ b/Source/SPFileHandle.m @@ -467,10 +467,10 @@ { [self closeFile]; - if (processingThread) [processingThread release]; + if (processingThread) SPClear(processingThread); free(wrappedFilePath); - [buffer release]; + SPClear(buffer); pthread_mutex_destroy(&bufferLock); diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index af39323c..aa504bc2 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -71,8 +71,8 @@ - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [tableContentStates release]; - [history release]; + SPClear(tableContentStates); + SPClear(history); [super dealloc]; } diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index cb1ba20b..d5391644 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -159,18 +159,16 @@ [NSObject cancelPreviousPerformRequestsWithTarget:self]; if(stateTimer != nil) { [stateTimer invalidate]; - [stateTimer release]; - stateTimer = nil; + SPClear(stateTimer); } - if (staticPrefix) [staticPrefix release]; - [mutablePrefix release]; - [textualInputCharacters release]; - [originalFilterString release]; - if(syncArrowImages) [syncArrowImages release]; - if(suggestions) [suggestions release]; - - if (filtered) [filtered release]; - if (databaseStructureRetrieval) [databaseStructureRetrieval release]; + SPClear(mutablePrefix); + SPClear(textualInputCharacters); + SPClear(originalFilterString); + if (staticPrefix) SPClear(staticPrefix); + if (syncArrowImages) SPClear(syncArrowImages); + if (suggestions) SPClear(suggestions); + if (filtered) SPClear(filtered); + if (databaseStructureRetrieval) SPClear(databaseStructureRetrieval); [super dealloc]; } @@ -181,8 +179,7 @@ // Invalidate the timer now to prevent retain cycles preventing deallocation if (stateTimer != nil) { [stateTimer invalidate]; - [stateTimer release]; - stateTimer = nil; + SPClear(stateTimer); } closeMe = YES; @@ -204,8 +201,7 @@ isQueryingDatabaseStructure = NO; if(stateTimer) { [stateTimer invalidate]; - [stateTimer release]; - stateTimer = nil; + SPClear(stateTimer); if(syncArrowImages) SPClear(syncArrowImages); [self performSelectorOnMainThread:@selector(reInvokeCompletion) withObject:nil waitUntilDone:YES]; closeMe = YES; @@ -222,8 +218,7 @@ { if(stateTimer) { [stateTimer invalidate]; - [stateTimer release]; - stateTimer = nil; + SPClear(stateTimer); } [theView setCompletionIsOpen:NO]; [self close]; diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index e4bdd1ec..3f194b24 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -109,21 +109,21 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - if(schemaDataFiltered) [schemaDataFiltered release]; - if(allSchemaKeys) [allSchemaKeys release]; - if(schemaData) [schemaData release]; - if(infoArray) [infoArray release]; - if(updatingConnections) [updatingConnections release]; - if(expandStatus2) [expandStatus2 release]; - if(cachedSortedKeys) [cachedSortedKeys release]; + if(schemaDataFiltered) SPClear(schemaDataFiltered); + if(allSchemaKeys) SPClear(allSchemaKeys); + if(schemaData) SPClear(schemaData); + if(infoArray) SPClear(infoArray); + if(updatingConnections) SPClear(updatingConnections); + if(expandStatus2) SPClear(expandStatus2); + if(cachedSortedKeys) SPClear(cachedSortedKeys); #ifndef SP_CODA /* dealloc ivars */ - [connectionIcon release]; - [databaseIcon release]; - [tableIcon release]; - [viewIcon release]; - [procedureIcon release]; - [functionIcon release]; - [fieldIcon release]; + SPClear(connectionIcon); + SPClear(databaseIcon); + SPClear(tableIcon); + SPClear(viewIcon); + SPClear(procedureIcon); + SPClear(functionIcon); + SPClear(fieldIcon); #endif [super dealloc]; diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m index 70f5662b..d0feec68 100644 --- a/Source/SPPrintController.m +++ b/Source/SPPrintController.m @@ -193,7 +193,7 @@ { [[printWebView mainFrame] loadHTMLString:HTMLString baseURL:nil]; - if (printThread) [printThread release]; + if (printThread) SPClear(printThread); } /** diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 649d4b5a..6522b884 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -971,7 +971,7 @@ - (void)dealloc { - [favorites release]; + SPClear(favorites); [super dealloc]; } diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m index a7a3ee98..d9bec2eb 100644 --- a/Source/SPSQLParser.m +++ b/Source/SPSQLParser.m @@ -790,8 +790,7 @@ TO_BUFFER_STATE to_scan_string (const char *); // Drop back to standard non-delimiter mode if the delimiter has ended if ([delimiter isEqualToString:[NSString stringWithFormat:@"%C", character]]) { - if (delimiter) [delimiter release]; - delimiter = nil; + if (delimiter) SPClear(delimiter); delimiterLengthMinusOne = 0; } @@ -1039,8 +1038,8 @@ TO_BUFFER_STATE to_scan_string (const char *); [self _clearCharCache]; } - (void) dealloc { - [string release]; - if (delimiter) [delimiter release]; + SPClear(string); + if (delimiter) SPClear(delimiter); if (charCacheEnd != -1) free(stringCharCache); [super dealloc]; } diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index c9a214ab..1c217986 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -711,8 +711,7 @@ SPKeychain *keychain = [[SPKeychain alloc] init]; [keychain addPassword:thePassword forName:@"SSH" account:currentKeyName withLabel:[NSString stringWithFormat:@"SSH: %@", currentKeyName]]; [keychain release]; - [currentKeyName release]; - currentKeyName = nil; + SPClear(currentKeyName); } } @@ -729,22 +728,22 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; if (connectionState != SPMySQLProxyIdle) [self disconnect]; [NSObject cancelPreviousPerformRequestsWithTarget:self]; - [sshHost release]; - [sshLogin release]; - [remoteHost release]; - [tunnelConnectionName release]; - [tunnelConnectionVerifyHash release]; + SPClear(sshHost); + SPClear(sshLogin); + SPClear(remoteHost); + SPClear(tunnelConnectionName); + SPClear(tunnelConnectionVerifyHash); [tunnelConnection invalidate]; - [tunnelConnection release]; - [debugMessages release]; - [debugMessagesLock release]; + SPClear(tunnelConnection); + SPClear(debugMessages); + SPClear(debugMessagesLock); [answerAvailableLock tryLock]; [answerAvailableLock unlock]; - [answerAvailableLock release]; - if (password) [password release]; - if (keychainName) [keychainName release]; - if (keychainAccount) [keychainAccount release]; - if (identityFilePath) [identityFilePath release]; + SPClear(answerAvailableLock); + if (password) SPClear(password); + if (keychainName) SPClear(keychainName); + if (keychainAccount) SPClear(keychainAccount); + if (identityFilePath) SPClear(identityFilePath); // As this object is not a NSWindowController, use manual top-level nib item management if (sshQuestionDialog) SPClear(sshQuestionDialog); diff --git a/Source/SPSplitView.m b/Source/SPSplitView.m index 599432cf..ed87f3c0 100644 --- a/Source/SPSplitView.m +++ b/Source/SPSplitView.m @@ -105,8 +105,8 @@ - (void)dealloc { - [viewMinimumSizes release]; - [viewMaximumSizes release]; + SPClear(viewMinimumSizes); + SPClear(viewMaximumSizes); if (animationTimer) [animationTimer invalidate], SPClear(animationTimer); if (animationRetainCycleBypassObject) SPClear(animationRetainCycleBypassObject); diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index b0d0f03c..9295c858 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -462,7 +462,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #endif // Reset sort column - if (sortCol) [sortCol release]; sortCol = nil; + if (sortCol) SPClear(sortCol); isDesc = NO; // Empty and disable filter options @@ -697,8 +697,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Otherwise, clear sorting } else { if (sortCol) { - [sortCol release]; - sortCol = nil; + SPClear(sortCol); } isDesc = NO; } @@ -1372,8 +1371,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper { if (tableLoadTimer) { [tableLoadTimer invalidate]; - [tableLoadTimer release]; - tableLoadTimer = nil; + SPClear(tableLoadTimer); } } @@ -1678,8 +1676,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // this is the same as saying (isDesc && !invert) || (!isDesc && invert) if (isDesc != invert) { - [sortCol release]; - sortCol = nil; + SPClear(sortCol); } else { isDesc = !isDesc; @@ -3494,8 +3491,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper } if(fieldEditor) { - [fieldEditor release]; - fieldEditor = nil; + SPClear(fieldEditor); } [[tableContentView window] makeFirstResponder:tableContentView]; @@ -4314,34 +4310,35 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper if(fieldEditor) SPClear(fieldEditor); [self clearTableLoadTimer]; - [tableLoadingCondition release]; - [tableValues release]; + SPClear(tableLoadingCondition); + SPClear(tableValues); pthread_mutex_destroy(&tableValuesLock); - [dataColumns release]; - [oldRow release]; + SPClear(dataColumns); + SPClear(oldRow); #ifndef SP_CODA for (id retainedObject in nibObjectsToRelease) [retainedObject release]; - [nibObjectsToRelease release]; - [paginationPopover release]; + SPClear(nibObjectsToRelease); + SPClear(paginationPopover); - [filterTableData release]; - if (lastEditedFilterTableValue) [lastEditedFilterTableValue release]; - if (filterTableDefaultOperator) [filterTableDefaultOperator release]; + SPClear(filterTableData); + if (lastEditedFilterTableValue) SPClear(lastEditedFilterTableValue); + if (filterTableDefaultOperator) SPClear(filterTableDefaultOperator); #endif - if (selectedTable) [selectedTable release]; - if (contentFilters) [contentFilters release]; - if (numberOfDefaultFilters) [numberOfDefaultFilters release]; - if (keys) [keys release]; - if (sortCol) [sortCol release]; - [usedQuery release]; - if (sortColumnToRestore) [sortColumnToRestore release]; - if (selectionToRestore) [selectionToRestore release]; + if (selectedTable) SPClear(selectedTable); + if (contentFilters) SPClear(contentFilters); + if (numberOfDefaultFilters) SPClear(numberOfDefaultFilters); + if (keys) SPClear(keys); + if (sortCol) SPClear(sortCol); + SPClear(usedQuery); + if (sortColumnToRestore) SPClear(sortColumnToRestore); + if (selectionToRestore) SPClear(selectionToRestore); + if (cqColumnDefinition) SPClear(cqColumnDefinition); + if (filterFieldToRestore) filterFieldToRestore = nil; if (filterComparisonToRestore) filterComparisonToRestore = nil; if (filterValueToRestore) filterValueToRestore = nil; if (firstBetweenValueToRestore) firstBetweenValueToRestore = nil; if (secondBetweenValueToRestore) secondBetweenValueToRestore = nil; - if (cqColumnDefinition) [cqColumnDefinition release]; [super dealloc]; } diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 86243956..320a0b66 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -329,18 +329,15 @@ [status removeAllObjects]; if (triggers != nil) { - [triggers release]; - triggers = nil; + SPClear(triggers); } if (tableEncoding != nil) { - [tableEncoding release]; - tableEncoding = nil; + SPClear(tableEncoding); } if (tableCreateSyntax != nil) { - [tableCreateSyntax release]; - tableCreateSyntax = nil; + SPClear(tableCreateSyntax); } } @@ -1395,16 +1392,16 @@ */ - (void)dealloc { - [columns release]; - [columnNames release]; - [constraints release]; - [status release]; - [primaryKeyColumns release]; - - if (triggers) [triggers release]; - if (tableEncoding) [tableEncoding release]; - if (tableCreateSyntax) [tableCreateSyntax release]; - if (mySQLConnection) [mySQLConnection release]; + SPClear(columns); + SPClear(columnNames); + SPClear(constraints); + SPClear(status); + SPClear(primaryKeyColumns); + + if (triggers) SPClear(triggers); + if (tableEncoding) SPClear(tableEncoding); + if (tableCreateSyntax) SPClear(tableCreateSyntax); + if (mySQLConnection) SPClear(mySQLConnection); pthread_mutex_destroy(&dataProcessingLock); diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 4b16bdc0..e1ce3e4d 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -470,8 +470,8 @@ { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [info release]; - [activities release]; + SPClear(info); + SPClear(activities); [super dealloc]; } diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 77e5c77b..32739eb3 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -1473,16 +1473,16 @@ static NSString *SPRemoveFieldAndForeignKey = @"SPRemoveFieldAndForeignKey"; [prefs removeObserver:indexesController forKeyPath:SPUseMonospacedFonts]; #endif - [tableFields release]; - [oldRow release]; - [enumFields release]; - [typeSuggestions release]; - [extraFieldSuggestions release]; + SPClear(tableFields); + SPClear(oldRow); + SPClear(enumFields); + SPClear(typeSuggestions); + SPClear(extraFieldSuggestions); SPClear(fieldValidation); - if (defaultValues) [defaultValues release]; - if (selectedTable) [selectedTable release]; + if (defaultValues) SPClear(defaultValues); + if (selectedTable) SPClear(selectedTable); [super dealloc]; } diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 147aec52..aa0d6ea2 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -328,8 +328,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; selectedTableType = (SPTableType)[[tableTypes objectAtIndex:itemToReselect] integerValue]; } else { - if (selectedTableName) [selectedTableName release]; - selectedTableName = nil; + if (selectedTableName) SPClear(selectedTableName); selectedTableType = SPTableTypeNone; } @@ -860,8 +859,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; NSIndexSet *indexes = [tablesListView selectedRowIndexes]; #endif // Update the selected table name and type - if (selectedTableName) [selectedTableName release]; - selectedTableName = nil; + if (selectedTableName) SPClear(selectedTableName); #ifndef SP_CODA /* ui manipulation */ @@ -2729,15 +2727,15 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; { [[NSNotificationCenter defaultCenter] removeObserver:self]; - [tables release]; - [tableTypes release]; + SPClear(tables); + SPClear(tableTypes); #ifndef SP_CODA - if (isTableListFiltered && filteredTables) [filteredTables release]; - if (isTableListFiltered && filteredTableTypes) [filteredTableTypes release]; + if (isTableListFiltered && filteredTables) SPClear(filteredTables); + if (isTableListFiltered && filteredTableTypes) SPClear(filteredTableTypes); #endif - if (selectedTableName) [selectedTableName release]; + if (selectedTableName) SPClear(selectedTableName); - if (addTableCharsetHelper) [addTableCharsetHelper release]; + if (addTableCharsetHelper) SPClear(addTableCharsetHelper); [super dealloc]; } diff --git a/Source/SPTextAndLinkCell.m b/Source/SPTextAndLinkCell.m index 89521e54..2aefbff5 100644 --- a/Source/SPTextAndLinkCell.m +++ b/Source/SPTextAndLinkCell.m @@ -70,7 +70,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) */ - (void) dealloc { - if (linkButton) [linkButton release]; + if (linkButton) SPClear(linkButton); [super dealloc]; } diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 4ed92f94..70fcefc5 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -3687,18 +3687,18 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS if (completionIsOpen) [completionPopup close], completionIsOpen = NO; #ifndef SP_CODA - [prefs release]; + SPClear(prefs); #endif - [lineNumberView release]; - if(queryHiliteColor) [queryHiliteColor release]; - if(queryEditorBackgroundColor) [queryEditorBackgroundColor release]; - if(commentColor) [commentColor release]; - if(quoteColor) [quoteColor release]; - if(keywordColor) [keywordColor release]; - if(backtickColor) [backtickColor release]; - if(numericColor) [numericColor release]; - if(variableColor) [variableColor release]; - if(otherTextColor) [otherTextColor release]; + SPClear(lineNumberView); + if(queryHiliteColor) SPClear(queryHiliteColor); + if(queryEditorBackgroundColor) SPClear(queryEditorBackgroundColor); + if(commentColor) SPClear(commentColor); + if(quoteColor) SPClear(quoteColor); + if(keywordColor) SPClear(keywordColor); + if(backtickColor) SPClear(backtickColor); + if(numericColor) SPClear(numericColor); + if(variableColor) SPClear(variableColor); + if(otherTextColor) SPClear(otherTextColor); [super dealloc]; } diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index 33564d81..0a7597f5 100644 --- a/Source/SPTooltip.m +++ b/Source/SPTooltip.m @@ -241,9 +241,9 @@ static CGFloat slow_in_out (CGFloat t) - (void)dealloc { [NSObject cancelPreviousPerformRequestsWithTarget:self]; - [didOpenAtDate release]; - [webView release]; - [webPreferences release]; + SPClear(didOpenAtDate); + SPClear(webView); + SPClear(webPreferences); [super dealloc]; } diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index bf78ab6f..e3f611c3 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -555,12 +555,12 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; didEndSelector:NULL contextInfo:nil]; - [errorsString release]; + SPClear(errorsString); return; } - [errorsString release]; + SPClear(errorsString); // Otherwise, close the sheet [NSApp endSheet:[self window] returnCode:0]; diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index 6edbb684..0666f1a7 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -537,7 +537,7 @@ enum { // Tear down the animations on the tab bar to stop redraws [tabBar destroyAnimations]; - [managedDatabaseConnections release]; + SPClear(managedDatabaseConnections); [super dealloc]; } |