@@ -28,13 +28,13 @@ #endif #ifdef OF_GNU_RUNTIME # import #endif +#ifdef OF_ATOMIC_OPS #import "atomic.h" - -#ifndef OF_ATOMIC_OPS +#else #import "threading.h" #endif struct pre_ivar { void **memchunks; @@ -510,22 +510,23 @@ #endif return self; } -- (int32_t)retainCount +- (size_t)retainCount { - return PRE_IVAR->retain_count; + assert(PRE_IVAR->retain_count >= 0); + return (size_t)PRE_IVAR->retain_count; } - (void)release { #ifdef OF_ATOMIC_OPS - if (!of_atomic_dec32(&PRE_IVAR->retain_count)) + if (of_atomic_dec32(&PRE_IVAR->retain_count) <= 0) [self dealloc]; #else - int32_t c; + size_t c; assert(of_spinlock_lock(&PRE_IVAR->retain_spinlock)); c = --PRE_IVAR->retain_count; assert(of_spinlock_unlock(&PRE_IVAR->retain_spinlock)); @@ -625,13 +626,13 @@ + autorelease { return self; } -+ (int32_t)retainCount ++ (size_t)retainCount { - return INT32_MAX; + return SIZE_MAX; } + (void)release { }