Advertisement
sophtwhere

NSObject+arcAgnostics.h

Nov 1st, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  NSObject+arcAgnostics.h
  3. //
  4. //  Created by Jonathan Annett on 1/11/13.
  5. //  Copyright (c) 2013 Sophtwhere. All rights reserved.
  6. //
  7.  
  8. #import <Foundation/Foundation.h>
  9.  
  10. @interface NSObject (arcAgnostics)
  11. -(id)  __SELF__;
  12. -(void)  __NOP__;
  13. @end
  14.  
  15.  
  16. #if __has_feature(objc_arc)
  17.  
  18.  
  19. #define release __NOP__
  20. #define autorelease __SELF__
  21. #define retain __SELF__
  22. #define SUPER_DEALLOC self __NOP__
  23.  
  24.  
  25. #undef Block_copy
  26. #undef Block_release
  27.  
  28. #define Block_copy(...)  ((__bridge __typeof(__VA_ARGS__))_Block_copy((__bridge const void *)(__VA_ARGS__)))
  29. #define Block_release(...) _Block_release((__bridge const void *)(__VA_ARGS__))
  30.  
  31.  
  32. #else
  33.  
  34.  
  35. #define SUPER_DEALLOC super dealloc
  36.  
  37. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement