View difference between Paste ID: R8QmTf8t and L8XguyKJ
SHOW: | | - or go back to the newest paste.
1-
- (id)retain
1+
- (void)release
2
{
3-
    NSIncrementExtraRefCount(self);
3+
    if(NSDecrementExtraRefCountWasZero(self))
4-
    return self;
4+
        [self dealloc];
5
}
6
7-
inline void
7+
BOOL
8-
NSIncrementExtraRefCount(id anObject)
8+
NSDecrementExtraRefCountWasZero(id anObject)
9
{
10-
    if(((struct obj_layout *)anObject[-1].retained == UINT_MAX - 1)
10+
    if(((struct obj_layout *)anObject)[-1].retained == 0){
11-
        [NSException raise: NSInternalInconsistancyException
11+
        return YES;
12-
                    format: @"NSIncrementExtraRefCount() asked to increment too far"];
12+
    } else {
13
        ((struct obj_layout *)anObject)[-1].retained--;
14-
    ((struct obj_layout *)anObject)[-1].retained++;
14+
        return NO;
15
    }
16
}