-
-
Save gurjitdhiman/0222a7a443d68fa00d3489a25aceb45c to your computer and use it in GitHub Desktop.
A header for bridging between ARC and non-ARC code, I.E., 32- vs. 64-bit OS X.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PPMacho_ARCBridge_h | |
#define PPMacho_ARCBridge_h | |
#include <AvailabilityMacros.h> | |
#if __has_feature(objc_arc) | |
#define SUPERDEALLOC | |
#define RELEASEOBJ(obj) | |
#define RETAINOBJ(obj) obj | |
#define RETAINOBJNORETURN(obj) | |
#define AUTORELEASEOBJ(obj) obj | |
#define AUTORELEASEOBJNORETURN(obj) | |
#define BRIDGE(toType, obj) (__bridge toType)(obj) | |
#define arcstrong strong | |
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 | |
#define arcweak weak | |
#define __arcweak __weak | |
#else | |
#define arcweak unsafe_unretained | |
#define __arcweak __unsafe_unretained | |
#endif | |
#else | |
#define SUPERDEALLOC [super dealloc] | |
#define RELEASEOBJ(obj) [obj release] | |
#define RETAINOBJ(obj) [obj retain] | |
#define RETAINOBJNORETURN(obj) [obj retain] | |
#define AUTORELEASEOBJ(obj) [obj autorelease] | |
#define AUTORELEASEOBJNORETURN(obj) [obj autorelease] | |
#define BRIDGE(toType, obj) (toType)obj | |
#ifdef __OBJC_GC__ | |
#define arcstrong strong | |
#define arcweak weak | |
#define __arcweak __weak | |
#else | |
#define arcstrong retain | |
#define arcweak assign | |
#define __arcweak | |
#endif | |
#endif | |
#define arcretain arcstrong | |
// Other useful functions for ARC/CoreFoundation data exchange: | |
// CFBridgingRetain(), CFBridgingRelease() | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment