From 2735e15bf5d4b3a976435ebb29ca9073de0e5071 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 4 Jan 2015 03:57:26 +0100 Subject: Formalize [x release], x = nil; convention Take this commit as a proposal to formalize our existing "[x release], x = nil;" convention by introducing a macro for it. Feel free to revert this commit if you see issues with the approch or implementation. --- Source/SPCSVParser.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/SPCSVParser.m') diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m index 09d8c989..88a2fbb5 100644 --- a/Source/SPCSVParser.m +++ b/Source/SPCSVParser.m @@ -469,7 +469,7 @@ */ - (void) setNullReplacementString:(NSString *)nullString { - if (nullReplacementString) [nullReplacementString release], nullReplacementString = nil; + if (nullReplacementString) SPClear(nullReplacementString); if (nullString) nullReplacementString = [[NSString alloc] initWithString:nullString]; } @@ -576,7 +576,7 @@ { NSMutableString *charactersToSkip; - if (skipCharacterSet) [skipCharacterSet release], skipCharacterSet = nil; + if (skipCharacterSet) SPClear(skipCharacterSet); charactersToSkip = [[NSMutableString alloc] init]; if (![fieldEndString isEqualToString:@" "] && ![fieldQuoteString isEqualToString:@" "] && ![escapeString isEqualToString:@" "] && ![lineEndString isEqualToString:@" "]) -- cgit v1.2.3 From e201531daa71ee1a2e2a0f927c619947126c9d3d Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 4 Jan 2015 21:15:43 +0100 Subject: Addition to commit 2735e15b --- Source/SPCSVParser.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Source/SPCSVParser.m') 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]; } -- cgit v1.2.3