@@ -20,30 +20,30 @@ #import "OFAutoreleasePool.h" #import "OFArray.h" #import "macros.h" -#if !defined(OF_COMPILER_TLS) && defined(OF_THREADS) +#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) # import "threading.h" # import "OFInitializationFailedException.h" #endif #import "autorelease.h" #define MAX_CACHE_SIZE 0x20 -#if defined(OF_COMPILER_TLS) +#if defined(OF_HAVE_COMPILER_TLS) static __thread OFAutoreleasePool **cache = NULL; -#elif defined(OF_THREADS) +#elif defined(OF_HAVE_THREADS) static of_tlskey_t cacheKey; #else static OFAutoreleasePool **cache = NULL; #endif @implementation OFAutoreleasePool -#if !defined(OF_COMPILER_TLS) && defined(OF_THREADS) +#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) + (void)initialize { if (self != [OFAutoreleasePool class]) return; @@ -53,11 +53,11 @@ } #endif + alloc { -#if !defined(OF_COMPILER_TLS) && defined(OF_THREADS) +#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) OFAutoreleasePool **cache = of_tlskey_get(cacheKey); #endif if (cache != NULL) { unsigned i; @@ -117,11 +117,11 @@ [self dealloc]; } - (void)dealloc { -#if !defined(OF_COMPILER_TLS) && defined(OF_THREADS) +#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) OFAutoreleasePool **cache = of_tlskey_get(cacheKey); #endif if (ignoreRelease) return; @@ -131,11 +131,11 @@ objc_autoreleasePoolPop(pool); if (cache == NULL) { cache = calloc(sizeof(OFAutoreleasePool*), MAX_CACHE_SIZE); -#if !defined(OF_COMPILER_TLS) && defined(OF_THREADS) +#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) if (!of_tlskey_set(cacheKey, cache)) { free(cache); cache = NULL; } #endif