Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1455,11 +1455,10 @@ AC_DEFINE(OF_HAVE_PLEDGE, 1, [Whether we have pledge()]) ]) AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_CHECK_HEADER(Foundation/NSObject.h, [ - AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m") AC_SUBST(BRIDGE, "bridge") AS_IF([test x"$enable_shared" != x"no"], [ AC_SUBST(OBJFWBRIDGE_SHARED_LIB, "${LIB_PREFIX}objfwbridge${LIB_SUFFIX}") Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -34,11 +34,10 @@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FORWARDING_A = @FORWARDING_A@ FORWARDING_FORWARDING_A = @FORWARDING_FORWARDING_A@ FORWARDING_FORWARDING_LIB_A = @FORWARDING_FORWARDING_LIB_A@ FORWARDING_LIB_A = @FORWARDING_LIB_A@ -FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ INVOCATION_A = @INVOCATION_A@ INVOCATION_INVOCATION_A = @INVOCATION_INVOCATION_A@ INVOCATION_INVOCATION_LIB_A = @INVOCATION_INVOCATION_LIB_A@ INVOCATION_LIB_A = @INVOCATION_LIB_A@ Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -21,11 +21,10 @@ OFASN1PrintableString.m \ OFASN1UTF8String.m \ OFASN1Value.m \ OFApplication.m \ OFArray.m \ - OFAutoreleasePool.m \ OFBlock.m \ OFCharacterSet.m \ OFColor.m \ OFConstantString.m \ OFCountedSet.m \ @@ -207,11 +206,10 @@ OFRangeValue.m \ OFRectangleValue.m \ OFSubarray.m \ OFUTF8String.m \ ${AUTORELEASE_M} \ - ${FOUNDATION_COMPAT_M} \ ${INSTANCE_M} \ ${LIBBASES_M} SRCS_FILES += OFFileURLHandler.m \ OFINIFileSettings.m SRCS_SOCKETS += OFHTTPURLHandler.m \ DELETED src/OFAutoreleasePool+Private.h Index: src/OFAutoreleasePool+Private.h ================================================================== --- src/OFAutoreleasePool+Private.h +++ src/OFAutoreleasePool+Private.h @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, - * 2018, 2019 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFAutoreleasePool.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface OFAutoreleasePool () -+ (void)of_handleThreadTermination; -- (void)of_super_dealloc; -@end - -OF_ASSUME_NONNULL_END DELETED src/OFAutoreleasePool.h Index: src/OFAutoreleasePool.h ================================================================== --- src/OFAutoreleasePool.h +++ src/OFAutoreleasePool.h @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, - * 2018, 2019 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFObject.h" - -OF_ASSUME_NONNULL_BEGIN - -/*! - * @class OFAutoreleasePool OFAutoreleasePool.h ObjFW/OFAutoreleasePool.h - * - * @brief A pool that keeps track of objects to release. - * - * The OFAutoreleasePool class is a class that keeps track of objects that will - * be released when the autorelease pool is released. - * - * Every thread has its own stack of autorelease pools. - */ -@interface OFAutoreleasePool: OFObject -{ - void *_pool; - bool _ignoreRelease; -} - -/*! - * @brief Adds an object to the autorelease pool at the top of the - * thread-specific autorelease pool stack. - * - * @param object The object to add to the autorelease pool - * @return The object - */ -+ (id)addObject: (id)object; - -/*! - * @brief Releases all objects in the autorelease pool. - * - * This does not free the memory allocated to store pointers to the objects in - * the pool, so reusing the pool does not allocate any memory until the previous - * number of objects is exceeded. It behaves this way to optimize loops that - * always work with the same or similar number of objects and call relaseObjects - * at the end of the loop, which is probably the most common case for - * releaseObjects. - */ -- (void)releaseObjects; - -/*! - * @brief Releases all objects in the autorelease pool and deallocates the pool. - */ -- (void)release; - -/*! - * @brief Releases all objects in the autorelease pool and deallocates the pool. - */ -- (void)drain; -@end - -#ifdef __cplusplus -extern "C" { -#endif -extern id of_autorelease(id); -#ifdef __cplusplus -} -#endif - -OF_ASSUME_NONNULL_END DELETED src/OFAutoreleasePool.m Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, - * 2018, 2019 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#import "OFAutoreleasePool.h" -#import "OFAutoreleasePool+Private.h" - -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) -# import "tlskey.h" -# -# import "OFInitializationFailedException.h" -#endif - -#define MAX_CACHE_SIZE 0x20 - -#if defined(OF_HAVE_COMPILER_TLS) -static thread_local OFAutoreleasePool **cache = NULL; -#elif defined(OF_HAVE_THREADS) -static of_tlskey_t cacheKey; -#else -static OFAutoreleasePool **cache = NULL; -#endif - -@implementation OFAutoreleasePool -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) -+ (void)initialize -{ - if (self != [OFAutoreleasePool class]) - return; - - if (!of_tlskey_new(&cacheKey)) - @throw [OFInitializationFailedException - exceptionWithClass: self]; -} -#endif - -+ (instancetype)alloc -{ -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFAutoreleasePool **cache = of_tlskey_get(cacheKey); -#endif - - if (cache != NULL) { - for (size_t i = 0; i < MAX_CACHE_SIZE; i++) { - if (cache[i] != NULL) { - OFAutoreleasePool *pool = cache[i]; - cache[i] = NULL; - return pool; - } - } - } - - return [super alloc]; -} - -+ (id)addObject: (id)object -{ - return _objc_rootAutorelease(object); -} - -+ (void)of_handleThreadTermination -{ -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFAutoreleasePool **cache = of_tlskey_get(cacheKey); -#endif - - if (cache != NULL) { - for (size_t i = 0; i < MAX_CACHE_SIZE; i++) - [cache[i] of_super_dealloc]; - - free(cache); - cache = NULL; - } -} - -- (instancetype)init -{ - self = [super init]; - - @try { - _pool = objc_autoreleasePoolPush(); - - _objc_rootAutorelease(self); - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)releaseObjects -{ - _ignoreRelease = true; - - objc_autoreleasePoolPop(_pool); - _pool = objc_autoreleasePoolPush(); - - _objc_rootAutorelease(self); - - _ignoreRelease = false; -} - -- (void)release -{ - [self dealloc]; -} - -- (void)drain -{ - [self dealloc]; -} - -- (void)of_super_dealloc -{ - [super dealloc]; -} - -- (void)dealloc -{ -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFAutoreleasePool **cache = of_tlskey_get(cacheKey); -#endif - - if (_ignoreRelease) - return; - - _ignoreRelease = true; - - objc_autoreleasePoolPop(_pool); - - if (cache == NULL) { - cache = calloc(sizeof(OFAutoreleasePool *), MAX_CACHE_SIZE); - -#if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - if (!of_tlskey_set(cacheKey, cache)) { - free(cache); - cache = NULL; - } -#endif - } - - if (cache != NULL) { - for (size_t i = 0; i < MAX_CACHE_SIZE; i++) { - if (cache[i] == NULL) { - _pool = NULL; - _ignoreRelease = false; - - cache[i] = self; - - return; - } - } - } - - [super dealloc]; -} - -- (instancetype)retain -{ - OF_UNRECOGNIZED_SELECTOR -} - -- (instancetype)autorelease -{ - OF_UNRECOGNIZED_SELECTOR -} -@end Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -470,11 +470,11 @@ * object deallocated if it reaches 0. */ - (void)release; /*! - * @brief Adds the object to the topmost OFAutoreleasePool of the thread's + * @brief Adds the object to the topmost autorelease pool of the thread's * autorelease pool stack. * * @return The object */ - (instancetype)autorelease; Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -49,12 +49,10 @@ # include <3ds/svc.h> #endif #import "OFThread.h" #import "OFThread+Private.h" -#import "OFAutoreleasePool+Private.h" -#import "OFAutoreleasePool.h" #import "OFDate.h" #import "OFDictionary.h" #ifdef OF_HAVE_SOCKETS # import "OFDNSResolver.h" #endif @@ -135,11 +133,10 @@ } [thread handleTermination]; objc_autoreleasePoolPop(thread->_pool); - [OFAutoreleasePool of_handleThreadTermination]; #if defined(OF_AMIGAOS) && defined(OF_HAVE_SOCKETS) if (thread.supportsSockets) of_socket_deinit(); #endif Index: src/ObjFW.h ================================================================== --- src/ObjFW.h +++ src/ObjFW.h @@ -16,11 +16,10 @@ */ #import "OFObject.h" #import "OFBlock.h" -#import "OFAutoreleasePool.h" #import "OFString.h" #import "OFCharacterSet.h" #import "OFData.h" #import "OFArray.h" DELETED src/foundation-compat.m Index: src/foundation-compat.m ================================================================== --- src/foundation-compat.m +++ src/foundation-compat.m @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, - * 2018, 2019 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -/* - * This file replaces NSAutoreleasePool with OFAutoreleasePool when it is - * linked. - * This is done so there is no conflict because OFBlocks are used (blocks are - * OFBlocks as soon as ObjFW is linked). An application expecting an NSBlock, - * but getting an OFBlock because ObjFW is linked, would fail to autorelease - * the block otherwise, as the block would be in an OFAutoreleasePool. By - * replacing NSAutoreleasePool with OFAutoreleasePool, the application will - * still properly free the autoreleased block. - * With autorelease pools now being part of the runtime, this is not really - * necessary anymore, as both, ObjFW and Foundation, use the runtime's pools if - * available. However, this is kept for compatibility with older versions of - * OS X, which don't ship with a runtime with autorelease pools. - */ - -#include "config.h" - -#import - -#import "OFAutoreleasePool.h" - -static id -alloc(Class self, SEL _cmd) -{ - return [OFAutoreleasePool alloc]; -} - -static void -addObject(Class self, SEL _cmd, id object) -{ - [OFAutoreleasePool addObject: object]; -} - -static id -autorelease(id self, SEL _cmd) -{ - [OFAutoreleasePool addObject: self]; - - return self; -} - -OF_CONSTRUCTOR() -{ - Class NSAutoreleasePool = objc_getClass("NSAutoreleasePool"); - Class NSObject = objc_getClass("NSObject"); - Method allocMethod; - Method addObjectMethod; - Method autoreleaseMethod; - - if (NSAutoreleasePool == Nil || NSObject == Nil) - return; - - allocMethod = class_getClassMethod(NSAutoreleasePool, - @selector(alloc)); - addObjectMethod = class_getClassMethod(NSAutoreleasePool, - @selector(addObject:)); - autoreleaseMethod = class_getInstanceMethod(NSObject, - @selector(autorelease)); - - if (allocMethod == NULL || addObjectMethod == NULL || - autoreleaseMethod == NULL) - return; - - class_replaceMethod(object_getClass(NSAutoreleasePool), - @selector(alloc), (IMP)alloc, method_getTypeEncoding(allocMethod)); - class_replaceMethod(object_getClass(NSAutoreleasePool), - @selector(addObject:), (IMP)addObject, - method_getTypeEncoding(addObjectMethod)); - class_replaceMethod(NSObject, @selector(autorelease), - (IMP)autorelease, method_getTypeEncoding(autoreleaseMethod)); -} Index: tests/ForwardingTests.m ================================================================== --- tests/ForwardingTests.m +++ tests/ForwardingTests.m @@ -178,11 +178,11 @@ @end @implementation TestsAppDelegate (ForwardingTests) - (void)forwardingTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); TEST(@"Forwarding a message and adding a class method", R([ForwardingTest test]) && success && R([ForwardingTest test]) && forwardings == 1); @@ -229,8 +229,8 @@ @"stret", OFNotImplementedException, [t forwardingTargetSelfStRetTest]) # endif #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFASN1DERRepresentationTests.m ================================================================== --- tests/OFASN1DERRepresentationTests.m +++ tests/OFASN1DERRepresentationTests.m @@ -22,11 +22,11 @@ static OFString *module; @implementation TestsAppDelegate (OFASN1DERRepresentationTests) - (void)ASN1DERRepresentationTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFData *data; module = @"OFASN1BitString"; TEST(@"-[ASN1DERRepresentation]", (data = [OFData dataWithItems: "\xFF\x00\xF8" @@ -66,8 +66,8 @@ TEST(@"-[OFASN1DERRepresentation]", [[[OFNull null] ASN1DERRepresentation] isEqual: [OFData dataWithItems: "\x05\x00" count: 2]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFASN1DERValueTests.m ================================================================== --- tests/OFASN1DERValueTests.m +++ tests/OFASN1DERValueTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFData+ASN1DERValue"; @implementation TestsAppDelegate (OFASN1DERValueTests) - (void)ASN1DERValueTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFASN1BitString *bitString; OFArray *array; OFSet *set; OFEnumerator *enumerator; @@ -430,8 +430,8 @@ EXPECT_EXCEPTION(@"Detection of truncated IA5String", OFTruncatedDataException, [[OFData dataWithItems: "\x16\x01" count: 2] ASN1DERValue]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -132,11 +132,11 @@ @implementation TestsAppDelegate (OFArrayTests) - (void)arrayTestsWithClass: (Class)arrayClass mutableClass: (Class)mutableArrayClass { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFArray *a[3]; OFMutableArray *m[2]; OFEnumerator *enumerator; id obj; bool ok; @@ -437,11 +437,11 @@ [m[0] isEqual: [arrayClass arrayWithObjects: [OFURL URLWithString: @"http://foo.bar:1234/"], [OFURL URLWithString: @"http://bar.qux:1234/"], [OFURL URLWithString: @"http://qux.quxqux:1234/"], nil]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } - (void)arrayTests { module = @"OFArray"; Index: tests/OFBlockTests.m ================================================================== --- tests/OFBlockTests.m +++ tests/OFBlockTests.m @@ -50,11 +50,11 @@ } @implementation TestsAppDelegate (OFBlockTests) - (void)blockTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); __block int x; void (^s)(void) = ^ { x = 0; }; void (^m)(void); int (^v)(void); @@ -99,8 +99,8 @@ #ifndef __clang_analyzer__ TEST(@"Autorelease a malloc block", R([m autorelease])) #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFCharacterSetTests.m ================================================================== --- tests/OFCharacterSetTests.m +++ tests/OFCharacterSetTests.m @@ -36,11 +36,11 @@ @end @implementation TestsAppDelegate (OFCharacterSetTests) - (void)characterSetTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFCharacterSet *cs, *ics; bool ok; module = @"OFCharacterSet"; @@ -101,8 +101,8 @@ TEST(@"-[invertedSet]", ok); TEST(@"Inverting -[invertedSet] returns original set", ics.invertedSet == cs) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFDNSResolverTests.m ================================================================== --- tests/OFDNSResolverTests.m +++ tests/OFDNSResolverTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFDNSResolverTests"; @implementation TestsAppDelegate (OFDNSResolverTests) - (void)DNSResolverTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFDNSResolver *resolver = [OFDNSResolver resolver]; OFMutableString *staticHosts = [OFMutableString string]; for (OFString *host in resolver.staticHosts) { OFString *IPs; @@ -59,8 +59,8 @@ PRINT(GREEN, @"Uses TCP: %u", resolver.usesTCP); PRINT(GREEN, @"Config reload interval: %lf", resolver.configReloadInterval); - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFDataTests.m ================================================================== --- tests/OFDataTests.m +++ tests/OFDataTests.m @@ -25,11 +25,11 @@ const char *str = "Hello!"; @implementation TestsAppDelegate (OFDataTests) - (void)dataTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableData *mutable; OFData *immutable; void *raw[2]; of_range_t range; @@ -206,8 +206,8 @@ EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, [mutable removeItemsInRange: of_range(mutable.count, 1)]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFDateTests.m ================================================================== --- tests/OFDateTests.m +++ tests/OFDateTests.m @@ -24,11 +24,11 @@ static OFString *module = @"OFDate"; @implementation TestsAppDelegate (OFDateTests) - (void)dateTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFDate *d1, *d2; struct tm tm; int16_t tz; const char *dstr = "Wed, 09 Jun 2021 +0200x"; @@ -97,8 +97,8 @@ TEST(@"-[earlierDate:]", [[d1 earlierDate: d2] isEqual: d1]) TEST(@"-[laterDate:]", [[d1 laterDate: d2] isEqual: d2]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -161,11 +161,11 @@ @implementation TestsAppDelegate (OFDictionaryTests) - (void)dictionaryTestsWithClass: (Class)dictionaryClass mutableClass: (Class)mutableDictionaryClass { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *mutDict = [mutableDictionaryClass dictionary]; OFDictionary *dict; OFEnumerator *keyEnumerator, *objectEnumerator; OFArray *keysArray, *valuesArray; @@ -382,11 +382,11 @@ ![mutDict isEqual: dict] && R([mutDict setObject: values[0] forKey: keys[0]]) && [mutDict isEqual: dict]) - [pool drain]; + objc_autoreleasePoolPop(pool); } - (void)dictionaryTests { module = @"OFDictionary"; Index: tests/OFHMACTests.m ================================================================== --- tests/OFHMACTests.m +++ tests/OFHMACTests.m @@ -50,11 +50,11 @@ "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; OFHMAC *HMAC_MD5, *HMAC_SHA1, *HMAC_RMD160; OFHMAC *HMAC_SHA256, *HMAC_SHA384, *HMAC_SHA512; @@ -128,8 +128,8 @@ HMAC_SHA384.digestSize) == 0) TEST(@"-[digest] with SHA-512", memcmp(HMAC_SHA512.digest, digest_sha512, HMAC_SHA512.digestSize) == 0) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFHTTPClientTests.m ================================================================== --- tests/OFHTTPClientTests.m +++ tests/OFHTTPClientTests.m @@ -107,11 +107,11 @@ [[OFRunLoop mainRunLoop] stop]; } - (void)HTTPClientTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); HTTPClientTestsServer *server; OFURL *URL; OFHTTPClient *client; OFHTTPRequest *request; OFData *data; @@ -151,8 +151,8 @@ (data = [response readDataUntilEndOfStream]) && data.count == 7 && memcmp(data.items, "foo\nbar", 7) == 0) [server join]; - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFHTTPCookieManagerTests.m ================================================================== --- tests/OFHTTPCookieManagerTests.m +++ tests/OFHTTPCookieManagerTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFHTTPCookieManager"; @implementation TestsAppDelegate (OFHTTPCookieManagerTests) - (void)HTTPCookieManagerTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFHTTPCookieManager *manager = [OFHTTPCookieManager manager]; OFURL *URL[4]; OFHTTPCookie *cookie[5]; URL[0] = [OFURL URLWithString: @"http://heap.zone/foo"]; @@ -98,8 +98,8 @@ [OFArray arrayWithObjects: cookie[2], cookie[3], cookie[4], nil]] && R([manager purgeExpiredCookies]) && [manager.cookies isEqual: [OFArray arrayWithObjects: cookie[3], cookie[4], nil]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFHTTPCookieTests.m ================================================================== --- tests/OFHTTPCookieTests.m +++ tests/OFHTTPCookieTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFHTTPCookie"; @implementation TestsAppDelegate (OFHTTPCookieTests) - (void)HTTPCookieTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFURL *URL = [OFURL URLWithString: @"http://heap.zone"]; OFHTTPCookie *cookie[2]; OFArray OF_GENERIC(OFHTTPCookie *) *cookies; cookie[0] = [OFHTTPCookie cookieWithName: @"foo" @@ -68,8 +68,8 @@ TEST(@"+[requestHeaderFieldsWithCookies:]", [[OFHTTPCookie requestHeaderFieldsWithCookies: cookies] isEqual: [OFDictionary dictionaryWithObject: @"foo=bar; qux=cookie" forKey: @"Cookie"]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFINIFileTests.m ================================================================== --- tests/OFINIFileTests.m +++ tests/OFINIFileTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFINIFile"; @implementation TestsAppDelegate (OFINIFileTests) - (void)INIFileTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFString *output = @"[tests]\r\n" @"foo=baz\r\n" @"foobar=baz\r\n" @";comment\r\n" @"new=new\r\n" @@ -139,8 +139,8 @@ [[OFFileManager defaultManager] removeItemAtPath: writePath]; #else (void)output; #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -253,11 +253,11 @@ } #endif - (void)invocationTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); SEL selector = @selector(invocationTestMethod1::::); OFMethodSignature *sig = [self methodSignatureForSelector: selector]; OFInvocation *invocation; struct test_struct st, st2, *stp = &st, *stp2; unsigned const char c = 0xAA; @@ -514,8 +514,8 @@ int128Result == __extension__ ((__int128)0xFFFFFFFFFFFFFFFF << 64) + 8) # endif #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFJSONTests.m ================================================================== --- tests/OFJSONTests.m +++ tests/OFJSONTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFJSON"; @implementation TestsAppDelegate (JSONTests) - (void)JSONTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFString *s = @"{\"foo\"\t:'b\\na\\r', \"x\":/*foo*/ [.5\r,0xF,null" @"//bar\n,\"foo\",false]}"; OFDictionary *d = [OFDictionary dictionaryWithKeysAndObjects: @"foo", @"b\na\r", @"x", [OFArray arrayWithObjects: @@ -83,8 +83,8 @@ EXPECT_EXCEPTION(@"-[JSONValue] #7", OFInvalidJSONException, [@"[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[{}]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]" JSONValue]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFKernelEventObserverTests.m ================================================================== --- tests/OFKernelEventObserverTests.m +++ tests/OFKernelEventObserverTests.m @@ -196,11 +196,11 @@ @end @implementation TestsAppDelegate (OFKernelEventObserverTests) - (void)kernelEventObserverTestsWithClass: (Class)class { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); ObserverTest *test; module = [class className]; test = [[[ObserverTest alloc] initWithTestsAppDelegate: self] autorelease]; @@ -212,11 +212,11 @@ R([test->_observer addObjectForReading: test->_server])) [test run]; _fails += test->_fails; - [pool drain]; + objc_autoreleasePoolPop(pool); } - (void)kernelEventObserverTests { #ifdef HAVE_SELECT Index: tests/OFListTests.m ================================================================== --- tests/OFListTests.m +++ tests/OFListTests.m @@ -27,11 +27,11 @@ }; @implementation TestsAppDelegate (OFListTests) - (void)listTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFList *list; OFEnumerator *enumerator; of_list_object_t *loe; OFString *obj; size_t i; @@ -144,8 +144,8 @@ ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFLocaleTests.m ================================================================== --- tests/OFLocaleTests.m +++ tests/OFLocaleTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFLocale"; @implementation TestsAppDelegate (OFLocaleTests) - (void)localeTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); PRINT(GREEN, @"Language: %@", [OFLocale language]); PRINT(GREEN, @"Territory: %@", [OFLocale territory]); @@ -33,8 +33,8 @@ PRINT(GREEN, @"Encoding: %@", of_string_name_of_encoding([OFLocale encoding])); PRINT(GREEN, @"Decimal point: %@", [OFLocale decimalPoint]); - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFMD5HashTests.m ================================================================== --- tests/OFMD5HashTests.m +++ tests/OFMD5HashTests.m @@ -27,11 +27,11 @@ "\x00\x8B\x9D\x1B\x58\xDF\xF8\xFE\xEE\xF3\xAE\x8D\xBB\x68\x2D\x38"; @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMD5Hash *md5, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (md5 = [OFMD5Hash cryptoHash])) @@ -54,8 +54,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException, [md5 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFMethodSignatureTests.m ================================================================== --- tests/OFMethodSignatureTests.m +++ tests/OFMethodSignatureTests.m @@ -72,11 +72,11 @@ }; @implementation TestsAppDelegate (OFMethodSignatureTests) - (void)methodSignatureTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMethodSignature *ms; TEST(@"-[:signatureWithObjCTypes:] #1", (ms = [OFMethodSignature signatureWithObjCTypes: "i28@0:8S16*20"]) && ms.numberOfArguments == 4 && @@ -170,8 +170,8 @@ TEST(@"of_alignof_type_encoding() #6", of_alignof_type_encoding(@encode(struct test1_struct [5])) == OF_ALIGNOF(struct test1_struct [5])) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFNumberTests.m ================================================================== --- tests/OFNumberTests.m +++ tests/OFNumberTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFNumber"; @implementation TestsAppDelegate (OFNumberTests) - (void)numberTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFNumber *num; TEST(@"+[numberWithIntMax:]", (num = [OFNumber numberWithIntMax: 123456789])) @@ -37,8 +37,8 @@ TEST(@"-[charValue]", num.charValue == 21) TEST(@"-[doubleValue]", num.doubleValue == 123456789.L) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFObjectTests.m ================================================================== --- tests/OFObjectTests.m +++ tests/OFObjectTests.m @@ -84,11 +84,11 @@ @end @implementation TestsAppDelegate (OFObjectTests) - (void)objectTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFObject *obj = [[[OFObject alloc] init] autorelease]; void *p, *q, *r; OFObject *o; MyObj *m; char *tmp; @@ -255,8 +255,8 @@ TEST(@"[-setValue:forKeyPath:]", R([m setValue: [OFNumber numberWithDouble: 0.75] forKeyPath: @"objectValue.objectValue.doubleValue"]) && [[m.objectValue objectValue] doubleValue] == 0.75) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFPluginTests.m ================================================================== --- tests/OFPluginTests.m +++ tests/OFPluginTests.m @@ -30,16 +30,16 @@ static OFString *module = @"OFPlugin"; @implementation TestsAppDelegate (OFPluginTests) - (void)pluginTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); TestPlugin *plugin; TEST(@"+[pluginFromFile:]", (plugin = [OFPlugin pluginFromFile: PLUGIN_PATH])) TEST(@"TestPlugin's -[test:]", [plugin test: 1234] == 2468) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFPropertyListTests.m ================================================================== --- tests/OFPropertyListTests.m +++ tests/OFPropertyListTests.m @@ -56,11 +56,11 @@ @""); @implementation TestsAppDelegate (OFPLISTParser) - (void)propertyListTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFArray *array = [OFArray arrayWithObjects: @"Hello", [OFData dataWithItems: "World!" count: 6], [OFDate dateWithTimeIntervalSince1970: 1521030896], @@ -112,8 +112,8 @@ EXPECT_EXCEPTION( @"-[propertyListValue] detecting invalid format #5", OFInvalidFormatException, [PLIST(@"") propertyListValue]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFRIPEMD160HashTests.m ================================================================== --- tests/OFRIPEMD160HashTests.m +++ tests/OFRIPEMD160HashTests.m @@ -28,11 +28,11 @@ "\xE6\x08\x8B"; @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFRIPEMD160Hash *rmd160, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (rmd160 = [OFRIPEMD160Hash cryptoHash])) @@ -55,8 +55,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length]", OFHashAlreadyCalculatedException, [rmd160 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA1HashTests.m ================================================================== --- tests/OFSHA1HashTests.m +++ tests/OFSHA1HashTests.m @@ -28,11 +28,11 @@ "\x94\xE7\x17"; @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSHA1Hash *sha1, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha1 = [OFSHA1Hash cryptoHash])) @@ -55,8 +55,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha1 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA224HashTests.m ================================================================== --- tests/OFSHA224HashTests.m +++ tests/OFSHA224HashTests.m @@ -28,11 +28,11 @@ "\x5F\x4F\x20\x02\x4D\x15\xED\x1C\x61\x1F\xF7"; @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSHA224Hash *sha224, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha224 = [OFSHA224Hash cryptoHash])) @@ -55,8 +55,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha224 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA256HashTests.m ================================================================== --- tests/OFSHA256HashTests.m +++ tests/OFSHA256HashTests.m @@ -28,11 +28,11 @@ "\x67\x93\x8F\x0F\x44\x90\xB8\xF5\x35\x89\xF0\x5A\x23\x7F\x69"; @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSHA256Hash *sha256, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha256 = [OFSHA256Hash cryptoHash])) @@ -55,8 +55,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha256 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA384HashTests.m ================================================================== --- tests/OFSHA384HashTests.m +++ tests/OFSHA384HashTests.m @@ -29,11 +29,11 @@ "\xE9\x1A\xB3\x51\x70\x8C\x1F\x3F\x56\x12\x44\x01\x91\x54"; @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSHA384Hash *sha384, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha384 = [OFSHA384Hash cryptoHash])) @@ -56,8 +56,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha384 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSHA512HashTests.m ================================================================== --- tests/OFSHA512HashTests.m +++ tests/OFSHA512HashTests.m @@ -30,11 +30,11 @@ "\xA1\x8A\x41\x64\x33\x69\x21\x8C\x2A\x44\x6D\xF2\xA0"; @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSHA512Hash *sha512, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha512 = [OFSHA512Hash cryptoHash])) @@ -57,8 +57,8 @@ EXPECT_EXCEPTION(@"Detect invalid call of " @"-[updateWithBuffer:length:]", OFHashAlreadyCalculatedException, [sha512 updateWithBuffer: "" length: 1]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSerializationTests.m ================================================================== --- tests/OFSerializationTests.m +++ tests/OFSerializationTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFSerialization"; @implementation TestsAppDelegate (OFSerializationTests) - (void)serializationTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *d = [OFMutableDictionary dictionary]; OFMutableArray *a = [OFMutableArray array]; OFList *l = [OFList list]; OFData *data; OFString *s; @@ -63,8 +63,8 @@ (s = d.stringBySerializing) && [s isEqual: [OFString stringWithContentsOfFile: @"serialization.xml"]]) TEST(@"-[objectByDeserializing]", [s.objectByDeserializing isEqual: d]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFSetTests.m ================================================================== --- tests/OFSetTests.m +++ tests/OFSetTests.m @@ -163,11 +163,11 @@ @implementation TestsAppDelegate (OFSetTests) - (void)setTestsWithClass: (Class)setClass mutableClass: (Class)mutableSetClass { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFSet *set1, *set2; OFMutableSet *mutableSet; bool ok; size_t i; @@ -281,11 +281,11 @@ [OFNumber numberWithSize: 1], [OFNumber numberWithSize: 2], [OFNumber numberWithSize: 3], nil]] && [[set1 valueForKey: @"@count"] isEqual: [OFNumber numberWithSize: 3]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } - (void)setTests { module = @"OFSet"; Index: tests/OFStreamTests.m ================================================================== --- tests/OFStreamTests.m +++ tests/OFStreamTests.m @@ -63,11 +63,11 @@ @end @implementation TestsAppDelegate (OFStreamTests) - (void)streamTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); size_t pageSize = [OFSystemInfo pageSize]; StreamTester *t = [[[StreamTester alloc] init] autorelease]; OFString *str; char *cstr; @@ -77,8 +77,8 @@ TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] && (str = [t readLine]).length == pageSize - 3 && !strcmp(str.UTF8String, cstr)) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -209,11 +209,11 @@ @implementation TestsAppDelegate (OFStringTests) - (void)stringTestsWithClass: (Class)stringClass mutableClass: (Class)mutableStringClass { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableString *s[3]; OFString *is; OFArray *a; size_t i; const of_unichar_t *ua; @@ -1422,11 +1422,11 @@ TEST(@"-[enumerateLinesUsingBlock:]", ok) #endif #undef C - [pool drain]; + objc_autoreleasePoolPop(pool); } - (void)stringTests { module = @"OFString"; Index: tests/OFSystemInfoTests.m ================================================================== --- tests/OFSystemInfoTests.m +++ tests/OFSystemInfoTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFSystemInfo"; @implementation TestsAppDelegate (OFSystemInfoTests) - (void)systemInfoTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); #ifdef OF_HAVE_FILES OFString *userConfigPath, *userDataPath; #endif PRINT(GREEN, @"Page size: %zd", [OFSystemInfo pageSize]); @@ -94,8 +94,8 @@ #ifdef OF_POWERPC PRINT(GREEN, @"Supports AltiVec: %d", [OFSystemInfo supportsAltiVec]); #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFTCPSocketTests.m ================================================================== --- tests/OFTCPSocketTests.m +++ tests/OFTCPSocketTests.m @@ -24,11 +24,11 @@ static OFString *module = @"OFTCPSocket"; @implementation TestsAppDelegate (OFTCPSocketTests) - (void)TCPSocketTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFTCPSocket *server, *client = nil, *accepted; uint16_t port; char buf[6]; TEST(@"+[socket]", (server = [OFTCPSocket socket]) && @@ -54,8 +54,8 @@ TEST(@"-[readIntoBuffer:length:]", [accepted readIntoBuffer: buf length: 6] && !memcmp(buf, "Hello!", 6)) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFThreadTests.m ================================================================== --- tests/OFThreadTests.m +++ tests/OFThreadTests.m @@ -35,11 +35,11 @@ @end @implementation TestsAppDelegate (OFThreadTests) - (void)threadTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); TestThread *t; OFMutableDictionary *d; TEST(@"+[thread]", (t = [TestThread thread])) @@ -48,8 +48,8 @@ TEST(@"-[join]", [[t join] isEqual: @"success"]) TEST(@"-[threadDictionary]", (d = [OFThread threadDictionary]) && [d objectForKey: @"foo"] == nil) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFUDPSocketTests.m ================================================================== --- tests/OFUDPSocketTests.m +++ tests/OFUDPSocketTests.m @@ -24,11 +24,11 @@ static OFString *module = @"OFUDPSocket"; @implementation TestsAppDelegate (OFUDPSocketTests) - (void)UDPSocketTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFUDPSocket *sock; uint16_t port1, port2; of_socket_address_t addr1, addr2, addr3; char buf[6]; OFString *host; @@ -66,8 +66,8 @@ TEST(@"of_socket_address_hash()", of_socket_address_hash(&addr1) == of_socket_address_hash(&addr2) && of_socket_address_hash(&addr1) != of_socket_address_hash(&addr3)) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFURLTests.m ================================================================== --- tests/OFURLTests.m +++ tests/OFURLTests.m @@ -24,11 +24,11 @@ @"pa%3Fth?que%23ry#frag%23ment"; @implementation TestsAppDelegate (OFURLTests) - (void)URLTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFURL *u1, *u2, *u3, *u4, *u5; OFMutableURL *mu; TEST(@"+[URLWithString:]", R(u1 = [OFURL URLWithString: url_str]) && @@ -280,8 +280,8 @@ [OFURL URLWithString: @"http://foo/bar/qux/"]] && [[[OFURL URLWithString: @"http://foo/bar/../../qux"] URLByStandardizingPath] isEqual: [OFURL URLWithString: @"http://foo/../qux"]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFValueTests.m ================================================================== --- tests/OFValueTests.m +++ tests/OFValueTests.m @@ -24,11 +24,11 @@ static OFString *module = @"OFValue"; @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); of_range_t range = of_range(1, 64), range2; of_point_t point = of_point(1.5, 3), point2; of_dimension_t dimension = of_dimension(4.5, 5), dimension2; of_rectangle_t rectangle = of_rectangle(1.5, 3, 4.5, 6), rectangle2; OFValue *value; @@ -167,8 +167,8 @@ ![[OFValue valueWithBytes: "a" objCType: @encode(char)] isEqual: [OFValue valueWithBytes: "b" objCType: @encode(char)]]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFWindowsRegistryKeyTests.m ================================================================== --- tests/OFWindowsRegistryKeyTests.m +++ tests/OFWindowsRegistryKeyTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFWindowsRegistryKey"; @implementation TestsAppDelegate (OFWindowsRegistryKeyTests) - (void)windowsRegistryKeyTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFData *data = [OFData dataWithItems: "abcdef" count: 6]; OFWindowsRegistryKey *softwareKey, *ObjFWKey; DWORD type; OFString *string; @@ -93,8 +93,8 @@ TEST(@"-[deleteValue:]", R([ObjFWKey deleteValue: @"data"])) TEST(@"-[deleteSubkeyAtPath:]", R([softwareKey deleteSubkeyAtPath: @"ObjFW"])) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFXMLElementBuilderTests.m ================================================================== --- tests/OFXMLElementBuilderTests.m +++ tests/OFXMLElementBuilderTests.m @@ -38,11 +38,11 @@ nodes[i++] = [node retain]; } - (void)XMLElementBuilderTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFXMLParser *p = [OFXMLParser parser]; OFXMLElementBuilder *builder = [OFXMLElementBuilder elementBuilder]; OFString *str = @"barbaz" " " ""; @@ -57,8 +57,8 @@ nodes[1] != nil && [nodes[1].XMLString isEqual: @""] && i == 2) [nodes[0] release]; [nodes[1] release]; - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFXMLNodeTests.m ================================================================== --- tests/OFXMLNodeTests.m +++ tests/OFXMLNodeTests.m @@ -22,11 +22,11 @@ static OFString *module = @"OFXMLNode"; @implementation TestsAppDelegate (OFXMLNodeTests) - (void)XMLNodeTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); id nodes[4]; OFArray *a; TEST(@"+[elementWithName:]", (nodes[0] = [OFXMLElement elementWithName: @"foo"]) && @@ -136,8 +136,8 @@ TEST(@"-[XMLStringWithIndentation:]", [[[OFXMLElement elementWithXMLString: @"a\nb" @""] XMLStringWithIndentation: 2] isEqual: @"\n \n a\nb\n \n \n"]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/OFXMLParserTests.m ================================================================== --- tests/OFXMLParserTests.m +++ tests/OFXMLParserTests.m @@ -320,11 +320,11 @@ return nil; } - (void)XMLParserTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); const char *str = "\xEF\xBB\xBF" "\r\r" " \n" " \r\n" " \n" @@ -390,8 +390,8 @@ parser = [OFXMLParser parser]; EXPECT_EXCEPTION(@"Detection of invalid XML processing instructions #3", OFMalformedXMLException, [parser parseString: @""]) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/PBKDF2Tests.m ================================================================== --- tests/PBKDF2Tests.m +++ tests/PBKDF2Tests.m @@ -24,11 +24,11 @@ static OFString *module = @"PBKDF2"; @implementation TestsAppDelegate (PBKDF2Tests) - (void)PBKDF2Tests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFHMAC *HMAC = [OFHMAC HMACWithHashClass: [OFSHA1Hash class]]; unsigned char key[25]; /* Test vectors from RFC 6070 */ @@ -70,8 +70,8 @@ R(of_pbkdf2(HMAC, 4096, (unsigned char *)"sa\0lt", 5, "pass\0word", 9, key, 16)) && memcmp(key, "\x56\xFA\x6A\xA7\x55\x48\x09\x9D\xCC\x37\xD7\xF0\x34" "\x25\xE0\xC3", 16) == 0) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/RuntimeTests.m ================================================================== --- tests/RuntimeTests.m +++ tests/RuntimeTests.m @@ -62,11 +62,11 @@ @end @implementation TestsAppDelegate (RuntimeTests) - (void)runtimeTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease]; OFString *t, *foo; EXPECT_EXCEPTION(@"Calling a non-existent method via super", OFNotImplementedException, [rt superTest]) @@ -82,8 +82,8 @@ rt.foo != foo && rt.foo.retainCount == 1) rt.bar = t; TEST(@"retain, atomic properties", rt.bar == t && t.retainCount == 3) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/ScryptTests.m ================================================================== --- tests/ScryptTests.m +++ tests/ScryptTests.m @@ -133,11 +133,11 @@ #endif @implementation TestsAppDelegate (ScryptTests) - (void)scryptTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); uint32_t salsa20Buffer[16]; uint32_t blockMixBuffer[32]; uint32_t ROMixBuffer[32], ROMixTmp[17 * 32]; unsigned char output[64]; @@ -174,8 +174,8 @@ R(of_scrypt(8, 1048576, 1, (unsigned char *)"SodiumChloride", 14, "pleaseletmein", 13, output, 64)) && memcmp(output, testVector4, 64) == 0) #endif - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/SocketTests.m ================================================================== --- tests/SocketTests.m +++ tests/SocketTests.m @@ -57,11 +57,11 @@ static OFString *module = @"Socket"; @implementation TestsAppDelegate (SocketTests) - (void)socketTests { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); of_socket_address_t addr; uint16_t port; TEST(@"Parsing an IPv4", R(addr = of_socket_address_parse_ip(@"127.0.0.1", 1234)) && @@ -219,8 +219,8 @@ TEST(@"Converting an IPv6 to a string #10", [of_socket_address_ip_string(&addr, &port) isEqual: @"::5566:7788:99aa:bbcc:0:0"] && port == 1234) - [pool drain]; + objc_autoreleasePoolPop(pool); } @end Index: tests/TestsAppDelegate.m ================================================================== --- tests/TestsAppDelegate.m +++ tests/TestsAppDelegate.m @@ -260,32 +260,32 @@ } - (void)outputTesting: (OFString *)test inModule: (OFString *)module { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); #ifndef STDOUT_SIMPLE [self outputString: [OFString stringWithFormat: @"[%@] %@: testing...", module, test] inColor: YELLOW]; #else [self outputString: [OFString stringWithFormat: @"[%@] %@: ", module, test] inColor: YELLOW]; #endif - [pool release]; + objc_autoreleasePoolPop(pool); } - (void)outputSuccess: (OFString *)test inModule: (OFString *)module { #ifndef STDOUT_SIMPLE - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self outputString: [OFString stringWithFormat: @"[%@] %@: ok\n", module, test] inColor: GREEN]; - [pool release]; + objc_autoreleasePoolPop(pool); #else [self outputString: @"ok\n" inColor: GREEN]; #endif } @@ -292,15 +292,15 @@ - (void)outputFailure: (OFString *)test inModule: (OFString *)module { #ifndef STDOUT_SIMPLE - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self outputString: [OFString stringWithFormat: @"[%@] %@: failed\n", module, test] inColor: RED]; - [pool release]; + objc_autoreleasePoolPop(pool); # ifdef OF_WII [self outputString: @"Press A to continue!\n" inColor: NO_COLOR]; for (;;) {