AndrewShmig

Untitled

May 1st, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (id)retain
  2. {
  3.     NSIncrementExtraRefCount(self);
  4.     return self;
  5. }
  6.  
  7. inline void
  8. NSIncrementExtraRefCount(id anObject)
  9. {
  10.     if(((struct obj_layout *)anObject[-1].retained == UINT_MAX - 1)
  11.         [NSException raise: NSInternalInconsistancyException
  12.                     format: @"NSIncrementExtraRefCount() asked to increment too far"];
  13.  
  14.     ((struct obj_layout *)anObject)[-1].retained++;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment