forked from BB9z/RFKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRFARC.h
100 lines (84 loc) · 2.14 KB
/
RFARC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*!
RFARC
RFKit
Copyright (c) 2012-2013 BB9z
https://github.com/bb9z/RFKit
The MIT License (MIT)
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef _RFKit_RFARC_h_
#define _RFKit_RFARC_h_
#pragma mark -
#pragma mark ARC Compatible Macro
#if __has_feature(objc_arc)
#define RF_AUTORELEASE(exp) exp
#define RF_RELEASE(exp) exp
#define RF_RETAIN(exp) exp
#define RF_DEALLOC(exp) exp
#define RF_AUTORELEASE_OBJ(obj)
#define RF_RELEASE_OBJ(obj)
#define RF_RETAIN_OBJ(obj)
#define RF_DEALLOC_OBJ(obj)
#else
#define RF_AUTORELEASE(exp) [exp autorelease]
#define RF_RELEASE(exp) [exp release]
#define RF_RETAIN(exp) [exp retain]
#define RF_DEALLOC(exp) [exp dealloc]
#define RF_AUTORELEASE_OBJ(obj) [obj autorelease];
#define RF_RELEASE_OBJ(obj) [obj release];
#define RF_RETAIN_OBJ(obj) [obj retain];
#define RF_DEALLOC_OBJ(obj) [obj dealloc];
#endif
#ifndef RF_STRONG
#if __has_feature(objc_arc)
#define RF_STRONG strong
#else
#define RF_STRONG retain
#endif
#endif
#ifndef RF_WEAK
#if __has_feature(objc_arc_weak)
#define RF_WEAK weak
#elif __has_feature(objc_arc)
#define RF_WEAK unsafe_unretained
#else
#define RF_WEAK assign
#endif
#endif
#if !__has_feature(objc_arc)
#define RF_IF_NO_ARC
#define RF_IF_NO_ARC_END
#else
#define RF_IF_NO_ARC if(0){
#define RF_IF_NO_ARC_END }
#endif
#pragma mark - GCD
#ifndef RF_GCD_STRONG
#if OS_OBJECT_USE_OBJC
#define RF_GCD_STRONG strong
#else
#define RF_GCD_STRONG assign
#endif
#endif
#ifndef RF_GCD_WEAK
#if OS_OBJECT_USE_OBJC
#define RF_GCD_WEAK weak
#else
#define RF_GCD_WEAK assign
#endif
#endif
#ifndef RF_dispatch_retain
#if OS_OBJECT_USE_OBJC
#define RF_dispatch_retain(expr)
#else
#define RF_dispatch_retain(expr) dispatch_retain(expr)
#endif
#endif
#ifndef RF_dispatch_release
#if OS_OBJECT_USE_OBJC
#define RF_dispatch_release(expr)
#else
#define RF_dispatch_release(expr) dispatch_release(expr)
#endif
#endif
#endif