diff options
author | Max <post@wickenrode.com> | 2015-01-04 03:57:26 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-01-04 03:57:26 +0100 |
commit | 2735e15bf5d4b3a976435ebb29ca9073de0e5071 (patch) | |
tree | e2088e442aa2d100ceafd8c0c4789e033fd12ac3 /Source/GeneratePreviewForURL.m | |
parent | db64bd1b5affd00332906901ee57d6f681faf7ea (diff) | |
download | sequelpro-2735e15bf5d4b3a976435ebb29ca9073de0e5071.tar.gz sequelpro-2735e15bf5d4b3a976435ebb29ca9073de0e5071.tar.bz2 sequelpro-2735e15bf5d4b3a976435ebb29ca9073de0e5071.zip |
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.
Diffstat (limited to 'Source/GeneratePreviewForURL.m')
-rw-r--r-- | Source/GeneratePreviewForURL.m | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index 1062f11d..ef20b852 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -78,8 +78,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - if(spf) [spf release], spf = nil; - if(pool) [pool release], pool = nil; + if(spf) SPClear(spf); + if(pool) SPClear(pool); return noErr; } @@ -89,8 +89,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - if(spf) [spf release], spf = nil; - if(pool) [pool release], pool = nil; + if(spf) SPClear(spf); + if(pool) SPClear(pool); return noErr; } @@ -146,8 +146,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - if(spf) [spf release], spf = nil; - if(pool) [pool release], pool = nil; + if(spf) SPClear(spf); + if(pool) SPClear(pool); return noErr; } // compose the html @@ -162,8 +162,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - if(spf) [spf release], spf = nil; - if(pool) [pool release], pool = nil; + if(spf) SPClear(spf); + if(pool) SPClear(pool); return noErr; } // compose the html @@ -182,7 +182,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - if(pool) [pool release], pool = nil; + if(pool) SPClear(pool); return noErr; } @@ -190,7 +190,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (windowTemplate == nil || ![windowTemplate length] || templateReadError != nil) { - if(pool) [pool release], pool = nil; + if(pool) SPClear(pool); return noErr; } @@ -205,8 +205,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - if(spf) [spf release], spf = nil; - if(pool) [pool release], pool = nil; + if(spf) SPClear(spf); + if(pool) SPClear(pool); return noErr; } @@ -323,7 +323,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, encoding:NSUTF8StringEncoding error:&templateReadError]; if (template == nil || ![template length] || templateReadError != nil) { - if(pool) [pool release], pool = nil; + if(pool) SPClear(pool); return noErr; } @@ -418,10 +418,10 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, [sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; if (QLPreviewRequestIsCancelled(preview)) { - if(sqlHTML) [sqlHTML release], sqlHTML = nil; + if(sqlHTML) SPClear(sqlHTML); if(truncatedString) [truncatedString release], sqlHTML = nil; if(sqlText) [sqlText release], sqlHTML = nil; - if(pool) [pool release], pool = nil; + if(pool) SPClear(pool); [loopPool release]; return noErr; } @@ -457,7 +457,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, } else { // No file attributes were read, bail for safety reasons - if(pool) [pool release], pool = nil; + if(pool) SPClear(pool); return noErr; } |