Revision: 47631
Updated Code
at June 12, 2011 00:27 by daknok
Updated Code
#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
Revision: 47630
Updated Code
at June 11, 2011 23:34 by daknok
Updated Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header to Cocoa. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil #ifdef DEBUG #define SXLog(format, ...) NSLog(@"%@ > %s (line %d): %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:format]) #else #define SXLog(format, ...) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL
Revision: 47629
Updated Code
at June 11, 2011 23:32 by daknok
Updated Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header to Cocoa. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil #ifdef DEBUG #define SXLog(format, ...) NSLog(@"%s > %s (line %d): %@", __FILE__, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:format]) #else #define SXLog(format, ...) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL
Revision: 47628
Updated Code
at June 11, 2011 23:19 by daknok
Updated Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header to Cocoa. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil #ifdef DEBUG #define SXLog(format, parameters) NSLog(@"%s > %s (line %d): %@", __FILE__, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:format, parameters]) #else #define SXLog(format, parameters) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL
Revision: 47627
Updated Code
at June 11, 2011 23:11 by daknok
Updated Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header to Cocoa. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil; while(0){} #ifdef DEBUG #define SXLog(format, parameters) NSLog(@"%s > %s (line %d): %@", __FILE__, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:format, parameters]) #else #define SXLog(format, parameters) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL; while(0){}
Revision: 47626
Updated Code
at June 11, 2011 22:01 by daknok
Updated Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header to Cocoa. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil; while(0){} #ifdef DEBUG #define SXLog(format, parameters) NSLog(@"%s: %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:format, parameters]) #else #define SXLog(format, parameters) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL; while(0){}
Revision: 47625
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 11, 2011 21:59 by daknok
Initial Code
#ifdef __OBJC__ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #warning "On Mac OS X, change the UIKit header. On iOS, remove this warning." #import <UIKit/UIKit.h> #import <CoreGraphics/CoreGraphics.h> #define SXRelease(o) [o release]; o = nil; while(0){} #ifdef DEBUG #define SXLog(format, parameters) NSLog(@"%s: %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:format, parameters]) #else #define SXLog(format, parameters) while(0){} #endif #endif #define SXFree(p) free(p); p = NULL; while(0){}
Initial URL
Initial Description
This prefix header adds `SXRelease()`, `SXFree()` and `SXLog()` which can be used instead of `-[<NSObject> 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.
Initial Title
Prefix header with better releasing, freeing and logging
Initial Tags
Initial Language
Objective C