]> git.saurik.com Git - apple/security.git/blob - utilities/src/SecCFRelease.h
Security-55471.14.tar.gz
[apple/security.git] / utilities / src / SecCFRelease.h
1 //
2 // SecCFRelease.h
3 // utilities
4 //
5 // Created by Mitch Adler on 2/9/12.
6 // Copyright (c) 2012 Apple Inc. All rights reserved.
7 //
8
9 #ifndef _SECCFRELEASE_H_
10 #define _SECCFRELEASE_H_
11
12 #include <CoreFoundation/CFBase.h>
13
14 #define CFRetainSafe(CF) { \
15 CFTypeRef _cf = (CF); \
16 if (_cf) \
17 CFRetain(_cf); \
18 }
19
20 #define CFReleaseSafe(CF) { \
21 CFTypeRef _cf = (CF); \
22 if (_cf) \
23 CFRelease(_cf); \
24 }
25
26 #define CFReleaseNull(CF) { \
27 CFTypeRef _cf = (CF); \
28 if (_cf) { \
29 (CF) = NULL; \
30 CFRelease(_cf); \
31 } \
32 }
33
34 #endif