/ Published in: Objective C
This prefix header adds `SXRelease()`, `SXFree()` and `SXLog()` which can be used instead of `-[ release]`, `free()` and `NSLog()`. In order to use `SXLog()`, you must have DEBUG defined somewhere, such as in the build settings of the debug configuration.
Please note that the `while(0){}` is to prevent errors where a single `;` is not permitted. The optimizer will remove this from the assembly code.
Please note that the `while(0){}` is to prevent errors where a single `;` is not permitted. The optimizer will remove this from the assembly code.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #import <AppKit/AppKit.h> #import <Cocoa/Cocoa.h> #define SXRelease(o) [o release]; o = nil #ifdef DEBUG #define SXLog(...) NSLog(@"%@ > %s (line %d): %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__, nil]) #else #define SXLog(...) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL