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/SPConstants.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/SPConstants.h') diff --git a/Source/SPConstants.h b/Source/SPConstants.h index 415fd4da..f0350f07 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -612,6 +612,13 @@ extern NSString *SPURLSchemeQueryResultMetaPathHeader; #define SPAppDelegate ((SPAppController *)[NSApp delegate]) +// Provides a standard method for our "[x release], x = nil;" convention. +// Yes, this could have been done with a preprocessor macro alone, however +// a function works more nicely in the debugger and in production code +// the optimizer will most likely remove all overhead by inlining anyway :) +void _SPClear(id *addr); +#define SPClear(x) _SPClear(&x) + //Backwards compatibility #ifndef __MAC_10_7 #define __MAC_10_7 1070 -- cgit v1.2.3