Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1451,11 +1451,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 @@ -10,11 +10,10 @@ LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} SRCS = OFApplication.m \ OFArray.m \ - OFAutoreleasePool.m \ OFBlock.m \ OFCharacterSet.m \ OFColor.m \ OFConstantString.m \ OFCountedSet.m \ @@ -194,11 +193,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 \ Index: src/OFAdjacentArray.h ================================================================== --- src/OFAdjacentArray.h +++ src/OFAdjacentArray.h @@ -19,12 +19,13 @@ OF_ASSUME_NONNULL_BEGIN @class OFMutableData; +OF_SUBCLASSING_RESTRICTED @interface OFAdjacentArray: OFArray { OFMutableData *_array; } @end OF_ASSUME_NONNULL_END Index: src/OFAdjacentSubarray.h ================================================================== --- src/OFAdjacentSubarray.h +++ src/OFAdjacentSubarray.h @@ -17,9 +17,10 @@ #import "OFSubarray.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFAdjacentSubarray: OFSubarray @end OF_ASSUME_NONNULL_END Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -42,10 +42,12 @@ /*! * @protocol OFApplicationDelegate OFApplication.h ObjFW/OFApplication.h * * @brief A protocol for delegates of OFApplication. + * + * @note Signals are not available on AmigaOS! */ @protocol OFApplicationDelegate /*! * @brief A method which is called when the application was initialized and is * running now. @@ -118,10 +120,11 @@ * * In order to create a new OFApplication, you should create a class conforming * to the optional @ref OFApplicationDelegate protocol and put * `OF_APPLICATION_DELEGATE(NameOfYourClass)` in the .m file of that class. */ +OF_SUBCLASSING_RESTRICTED @interface OFApplication: OFObject { OFString *_programName; OFArray OF_GENERIC(OFString *) *_arguments; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *_environment; @@ -136,11 +139,12 @@ void (*_Nullable _SIGHUPHandler)(id, SEL); void (*_Nullable _SIGUSR1Handler)(id, SEL); void (*_Nullable _SIGUSR2Handler)(id, SEL); #endif #ifdef OF_HAVE_SANDBOX - OFSandbox *_Nullable _activeSandbox, *_Nullable _activeExecSandbox; + OFSandbox *_Nullable _activeSandbox; + OFSandbox *_Nullable _activeSandboxForChildProcesses; #endif } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nullable, nonatomic) @@ -179,15 +183,14 @@ * @brief The sandbox currently active for this application. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFSandbox *activeSandbox; /*! - * @brief The sandbox currently active for `exec()`'d processes of this - * application. + * @brief The sandbox currently active for child processes of this application. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) - OFSandbox *activeExecSandbox; + OFSandbox *activeSandboxForChildProcesses; #endif /*! * @brief Returns the only OFApplication instance in the application. * @@ -233,22 +236,22 @@ * @brief Activates the specified sandbox for the application. * * This is only available if `OF_HAVE_SANDBOX` is defined. * * @warning If you allow `exec()`, but do not call - * @ref activateSandboxForExecdProcesses, an `exec()`'d process does not have - * its permissions restricted! + * @ref activateSandboxForChildProcesses:, an `exec()`'d process does + * not have its permissions restricted! * * @note Once a sandbox has been activated, you cannot activate a different * sandbox. You can however change the active sandbox and reactivate it. * * @param sandbox The sandbox to activate */ + (void)activateSandbox: (OFSandbox *)sandbox; /*! - * @brief Activates the specified sandbox for `exec()`'d processes of the + * @brief Activates the specified sandbox for child processes of the * application. * * This is only available if `OF_HAVE_SANDBOX` is defined. * * `unveiledPaths` on the sandbox must *not* be empty, otherwise an @@ -257,11 +260,11 @@ * @note Once a sandbox has been activated, you cannot activate a different * sandbox. You can however change the active sandbox and reactivate it. * * @param sandbox The sandbox to activate */ -+ (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox; ++ (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox; #endif - (instancetype)init OF_UNAVAILABLE; /*! @@ -290,22 +293,22 @@ * @brief Activates the specified sandbox for the application. * * This is only available if `OF_HAVE_SANDBOX` is defined. * * @warning If you allow `exec()`, but do not call - * @ref activateSandboxForExecdProcesses, an `exec()`'d process does not have - * its permissions restricted! + * @ref activateSandboxForChildProcesses:, an `exec()`'d process does + * not have its permissions restricted! * * @note Once a sandbox has been activated, you cannot activate a different * sandbox. You can however change the active sandbox and reactivate it. * * @param sandbox The sandbox to activate */ - (void)activateSandbox: (OFSandbox *)sandbox; /*! - * @brief Activates the specified sandbox for `exec()`'d processes of the + * @brief Activates the specified sandbox for child processes of the * application. * * This is only available if `OF_HAVE_SANDBOX` is defined. * * `unveiledPaths` on the sandbox must *not* be empty, otherwise an @@ -314,11 +317,11 @@ * @note Once a sandbox has been activated, you cannot activate a different * sandbox. You can however change the active sandbox and reactivate it. * * @param sandbox The sandbox to activate */ -- (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox; +- (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox; #endif @end #ifdef __cplusplus extern "C" { Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -154,11 +154,11 @@ @implementation OFApplication @synthesize programName = _programName, arguments = _arguments; @synthesize environment = _environment; #ifdef OF_HAVE_SANDBOX @synthesize activeSandbox = _activeSandbox; -@synthesize activeExecSandbox = _activeExecSandbox; +@synthesize activeSandboxForChildProcesses = _activeSandboxForChildProcesses; #endif + (OFApplication *)sharedApplication { return app; @@ -203,13 +203,13 @@ + (void)activateSandbox: (OFSandbox *)sandbox { [app activateSandbox: sandbox]; } -+ (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox ++ (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox { - [app activateSandboxForExecdProcesses: sandbox]; + [app activateSandboxForChildProcesses: sandbox]; } #endif - (instancetype)init { @@ -628,17 +628,18 @@ if (_activeSandbox == nil) _activeSandbox = [sandbox retain]; # endif } -- (void)activateSandboxForExecdProcesses: (OFSandbox *)sandbox +- (void)activateSandboxForChildProcesses: (OFSandbox *)sandbox { # ifdef OF_HAVE_PLEDGE void *pool = objc_autoreleasePoolPush(); const char *promises; - if (_activeExecSandbox != nil && sandbox != _activeExecSandbox) + if (_activeSandboxForChildProcesses != nil && + sandbox != _activeSandboxForChildProcesses) @throw [OFInvalidArgumentException exception]; if (sandbox.unveiledPaths.count != 0) @throw [OFInvalidArgumentException exception]; @@ -650,11 +651,11 @@ exceptionWithSandbox: sandbox errNo: errno]; objc_autoreleasePoolPop(pool); - if (_activeExecSandbox == nil) - _activeExecSandbox = [sandbox retain]; + if (_activeSandboxForChildProcesses == nil) + _activeSandboxForChildProcesses = [sandbox retain]; # endif } #endif @end Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -90,10 +90,14 @@ * @note Subclasses must implement @ref count and @ref objectAtIndex:. */ @interface OFArray OF_GENERIC(ObjectType): OFObject +{ + OF_RESERVE_IVARS(4) +} + #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif /*! * @brief The objects of the array as a C array. 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/OFBitSetCharacterSet.h ================================================================== --- src/OFBitSetCharacterSet.h +++ src/OFBitSetCharacterSet.h @@ -17,13 +17,14 @@ #import "OFCharacterSet.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFBitSetCharacterSet: OFCharacterSet { unsigned char *_bitset; size_t _size; } @end OF_ASSUME_NONNULL_END Index: src/OFBlock.h ================================================================== --- src/OFBlock.h +++ src/OFBlock.h @@ -29,15 +29,18 @@ @interface OFBlock: OFObject + (instancetype)alloc OF_UNAVAILABLE; - (instancetype)init OF_UNAVAILABLE; @end +OF_SUBCLASSING_RESTRICTED @interface OFStackBlock: OFBlock @end +OF_SUBCLASSING_RESTRICTED @interface OFGlobalBlock: OFBlock @end +OF_SUBCLASSING_RESTRICTED @interface OFMallocBlock: OFBlock @end OF_ASSUME_NONNULL_END Index: src/OFBytesValue.h ================================================================== --- src/OFBytesValue.h +++ src/OFBytesValue.h @@ -17,14 +17,15 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFBytesValue: OFValue { size_t _size; void *_bytes; const char *_objCType; } @end OF_ASSUME_NONNULL_END Index: src/OFCharacterSet.h ================================================================== --- src/OFCharacterSet.h +++ src/OFCharacterSet.h @@ -26,10 +26,14 @@ * @brief A class cluster representing a character set. * * @note Subclasses must implement @ref characterIsMember:. */ @interface OFCharacterSet: OFObject +{ + OF_RESERVE_IVARS(4) +} + #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFCharacterSet *whitespaceCharacterSet; #endif /*! Index: src/OFColor.h ================================================================== --- src/OFColor.h +++ src/OFColor.h @@ -25,10 +25,11 @@ * @brief A class for storing a color. */ @interface OFColor: OFObject { float _red, _green, _blue, _alpha; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new color with the specified red, green, blue and alpha * value. Index: src/OFCondition.h ================================================================== --- src/OFCondition.h +++ src/OFCondition.h @@ -26,10 +26,11 @@ /*! * @class OFCondition OFCondition.h ObjFW/OFCondition.h * * @brief A class implementing a condition variable for thread synchronization. */ +OF_SUBCLASSING_RESTRICTED @interface OFCondition: OFMutex { of_condition_t _condition; bool _conditionInitialized; } Index: src/OFConstantString.h ================================================================== --- src/OFConstantString.h +++ src/OFConstantString.h @@ -33,13 +33,14 @@ /*! * @class OFConstantString OFConstantString.h ObjFW/OFConstantString.h * * @brief A class for storing constant strings using the `@""` literal. */ +OF_SUBCLASSING_RESTRICTED @interface OFConstantString: OFString { char *_cString; unsigned int _cStringLength; } @end OF_ASSUME_NONNULL_END Index: src/OFCountedMapTableSet.h ================================================================== --- src/OFCountedMapTableSet.h +++ src/OFCountedMapTableSet.h @@ -19,12 +19,13 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; +OF_SUBCLASSING_RESTRICTED @interface OFCountedMapTableSet: OFCountedSet { OFMapTable *_mapTable; } @end OF_ASSUME_NONNULL_END Index: src/OFCountedSet.h ================================================================== --- src/OFCountedSet.h +++ src/OFCountedSet.h @@ -46,10 +46,14 @@ @interface OFCountedSet OF_GENERIC(ObjectType): OFMutableSet OF_GENERIC(ObjectType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Returns how often the object is in the set. * * @return How often the object is in the set */ Index: src/OFDNSResolver.h ================================================================== --- src/OFDNSResolver.h +++ src/OFDNSResolver.h @@ -119,10 +119,11 @@ * @note If you change any of the properties, make sure to set * @ref configReloadInterval to 0, as otherwise your changes will be * reverted back to the system configuration on the next periodic config * reload. */ +OF_SUBCLASSING_RESTRICTED @interface OFDNSResolver: OFObject { OFDictionary OF_GENERIC(OFString *, OFArray OF_GENERIC(OFString *) *) *_staticHosts; OFArray OF_GENERIC(OFString *) *_nameServers; Index: src/OFDNSResourceRecord.h ================================================================== --- src/OFDNSResourceRecord.h +++ src/OFDNSResourceRecord.h @@ -75,10 +75,11 @@ { OFString *_name; of_dns_resource_record_class_t _recordClass; of_dns_resource_record_type_t _recordType; uint32_t _TTL; + OF_RESERVE_IVARS(4) } /** * @brief The domain name to which the resource record belongs. */ @@ -119,10 +120,11 @@ /*! * @class OFADNSResourceRecord OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an A DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFADNSResourceRecord: OFDNSResourceRecord { of_socket_address_t _address; } @@ -154,10 +156,11 @@ * @class OFAAAADNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class represenging a DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFAAAADNSResourceRecord: OFDNSResourceRecord { of_socket_address_t _address; } @@ -189,10 +192,11 @@ * @class OFCNAMEDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing a CNAME DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFCNAMEDNSResourceRecord: OFDNSResourceRecord { OFString *_alias; } @@ -226,10 +230,11 @@ * @class OFHINFODNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an HINFO DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFHINFODNSResourceRecord: OFDNSResourceRecord { OFString *_CPU, *_OS; } @@ -270,10 +275,11 @@ * @class OFMXDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an MX DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFMXDNSResourceRecord: OFDNSResourceRecord { uint16_t _preference; OFString *_mailExchange; } @@ -315,10 +321,11 @@ * @class OFNSDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an NS DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFNSDNSResourceRecord: OFDNSResourceRecord { OFString *_authoritativeHost; } @@ -352,10 +359,11 @@ * @class OFPTRDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing a PTR DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFPTRDNSResourceRecord: OFDNSResourceRecord { OFString *_domainName; } @@ -389,10 +397,11 @@ * @class OFRPNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an RP DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFRPDNSResourceRecord: OFDNSResourceRecord { OFString *_mailbox, *_TXTDomainName; } @@ -435,10 +444,11 @@ * @class OFSOADNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an SOA DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFSOADNSResourceRecord: OFDNSResourceRecord { OFString *_primaryNameServer, *_responsiblePerson; uint32_t _serialNumber, _refreshInterval, _retryInterval; uint32_t _expirationInterval, _minTTL; @@ -516,10 +526,11 @@ * @class OFSRVDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing an SRV DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFSRVDNSResourceRecord: OFDNSResourceRecord { uint16_t _priority, _weight; OFString *_target; uint16_t _port; @@ -574,10 +585,11 @@ * @class OFTXTDNSResourceRecord \ * OFDNSResourceRecord.h ObjFW/OFDNSResourceRecord.h * * @brief A class representing a TXT DNS resource record. */ +OF_SUBCLASSING_RESTRICTED @interface OFTXTDNSResourceRecord: OFDNSResourceRecord { OFData *_textData; } Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -41,10 +41,11 @@ { unsigned char *_items; size_t _count, _itemSize; bool _freeWhenDone; OFData *_parentData; + OF_RESERVE_IVARS(4) } /*! * @brief The size of a single item in the OFData in bytes. */ Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -27,10 +27,11 @@ /*! * @class OFDate OFDate.h ObjFW/OFDate.h * * @brief A class for storing, accessing and comparing dates. */ +OF_SUBCLASSING_RESTRICTED @interface OFDate: OFObject { of_time_interval_t _seconds; } Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -60,10 +60,14 @@ OFMessagePackRepresentation> #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define KeyType id # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief An array of all keys. */ @property (readonly, nonatomic) OFArray OF_GENERIC(KeyType) *allKeys; Index: src/OFDimensionValue.h ================================================================== --- src/OFDimensionValue.h +++ src/OFDimensionValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFDimensionValue: OFValue { of_dimension_t _dimension; } @end OF_ASSUME_NONNULL_END Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -94,10 +94,14 @@ */ @interface OFEnumerator OF_GENERIC(ObjectType): OFObject #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Returns the next object or `nil` if there is none left. * * @return The next object or `nil` if there is none left */ Index: src/OFEpollKernelEventObserver.h ================================================================== --- src/OFEpollKernelEventObserver.h +++ src/OFEpollKernelEventObserver.h @@ -19,13 +19,14 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; +OF_SUBCLASSING_RESTRICTED @interface OFEpollKernelEventObserver: OFKernelEventObserver { int _epfd; OFMapTable *_FDToEvents; } @end OF_ASSUME_NONNULL_END Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -34,10 +34,11 @@ /*! * @class OFFile OFFile.h ObjFW/OFFile.h * * @brief A class which provides methods to read and write files. */ +OF_SUBCLASSING_RESTRICTED @interface OFFile: OFSeekableStream #ifdef OF_FILE_HANDLE_IS_FD #endif { Index: src/OFFileManager.h ================================================================== --- src/OFFileManager.h +++ src/OFFileManager.h @@ -240,10 +240,13 @@ * @class OFFileManager OFFileManager.h ObjFW/OFFileManager.h * * @brief A class which provides management for files, e.g. reading contents of * directories, deleting files, renaming files, etc. */ +#ifndef OF_FILE_MANAGER_M +OF_SUBCLASSING_RESTRICTED +#endif @interface OFFileManager: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFFileManager *defaultManager; #endif Index: src/OFFileManager.m ================================================================== --- src/OFFileManager.m +++ src/OFFileManager.m @@ -14,10 +14,12 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" + +#define OF_FILE_MANAGER_M #include #include #include "unistd_wrapper.h" Index: src/OFFileURLHandler.h ================================================================== --- src/OFFileURLHandler.h +++ src/OFFileURLHandler.h @@ -17,10 +17,11 @@ #import "OFURLHandler.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFFileURLHandler: OFURLHandler + (bool)of_directoryExistsAtPath: (OFString *)path; @end OF_ASSUME_NONNULL_END Index: src/OFGZIPStream.h ================================================================== --- src/OFGZIPStream.h +++ src/OFGZIPStream.h @@ -26,10 +26,11 @@ * @class OFGZIPStream OFGZIPStream.h ObjFW/OFGZIPStream.h * * @brief A class that handles GZIP compression and decompression transparently * for an underlying stream. */ +OF_SUBCLASSING_RESTRICTED @interface OFGZIPStream: OFStream { OFStream *_stream; OFInflateStream *_Nullable _inflateStream; enum of_gzip_stream_state { Index: src/OFHMAC.h ================================================================== --- src/OFHMAC.h +++ src/OFHMAC.h @@ -23,10 +23,11 @@ /*! * @class OFHMAC OFHMAC.h ObjFW/OFHMAC.h * * @brief A class which provides methods to calculate an HMAC. */ +OF_SUBCLASSING_RESTRICTED @interface OFHMAC: OFObject { Class _hashClass; id _Nullable _outerHash, _innerHash; id _Nullable _outerHashCopy, _innerHashCopy; Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -138,10 +138,11 @@ /*! * @class OFHTTPClient OFHTTPClient.h ObjFW/OFHTTPClient.h * * @brief A class for performing HTTP requests. */ +OF_SUBCLASSING_RESTRICTED @interface OFHTTPClient: OFObject { #ifdef OF_HTTPCLIENT_M @public #endif Index: src/OFHTTPCookie.h ================================================================== --- src/OFHTTPCookie.h +++ src/OFHTTPCookie.h @@ -35,10 +35,11 @@ { OFString *_name, *_value, *_domain, *_path; OFDate *_Nullable _expires; bool _secure, _HTTPOnly; OFMutableArray OF_GENERIC(OFString *) *_extensions; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the cookie. */ Index: src/OFHTTPCookieManager.h ================================================================== --- src/OFHTTPCookieManager.h +++ src/OFHTTPCookieManager.h @@ -27,10 +27,11 @@ /*! * @class OFHTTPCookieManager OFHTTPCookieManager.h ObjFW/OFHTTPCookieManager.h * * @brief A class for managing cookies for multiple domains. */ +OF_SUBCLASSING_RESTRICTED @interface OFHTTPCookieManager: OFObject { OFMutableArray OF_GENERIC(OFHTTPCookie *) *_cookies; } Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -74,10 +74,11 @@ OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers; of_socket_address_t _remoteAddress; + OF_RESERVE_IVARS(4) } /*! * @brief The URL of the HTTP request. */ Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -31,10 +31,11 @@ @interface OFHTTPResponse: OFStream { of_http_request_protocol_version_t _protocolVersion; short _statusCode; OFDictionary OF_GENERIC(OFString *, OFString *) *_headers; + OF_RESERVE_IVARS(4) } /*! * @brief The protocol version of the HTTP request reply. */ Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -88,10 +88,11 @@ /*! * @class OFHTTPServer OFHTTPServer.h ObjFW/OFHTTPServer.h * * @brief A class for creating a simple HTTP server inside of applications. */ +OF_SUBCLASSING_RESTRICTED @interface OFHTTPServer: OFObject { OFString *_Nullable _host; uint16_t _port; bool _usesTLS; Index: src/OFHTTPURLHandler.h ================================================================== --- src/OFHTTPURLHandler.h +++ src/OFHTTPURLHandler.h @@ -17,9 +17,10 @@ #import "OFURLHandler.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFHTTPURLHandler: OFURLHandler @end OF_ASSUME_NONNULL_END Index: src/OFINICategory.h ================================================================== --- src/OFINICategory.h +++ src/OFINICategory.h @@ -26,10 +26,11 @@ /*! * @class OFINICategory OFINICategory.h ObjFW/OFINICategory.h * * @brief A class for representing a category of an INI file. */ +OF_SUBCLASSING_RESTRICTED @interface OFINICategory: OFObject { OFString *_name; OFMutableArray *_lines; } Index: src/OFINIFile.h ================================================================== --- src/OFINIFile.h +++ src/OFINIFile.h @@ -26,10 +26,11 @@ /*! * @class OFINIFile OFINIFile.h ObjFW/OFINIFile.h * * @brief A class for reading, creating and modifying INI files. */ +OF_SUBCLASSING_RESTRICTED @interface OFINIFile: OFObject { OFMutableArray OF_GENERIC(OFINICategory *) *_categories; } Index: src/OFINIFileSettings.h ================================================================== --- src/OFINIFileSettings.h +++ src/OFINIFileSettings.h @@ -20,13 +20,14 @@ OF_ASSUME_NONNULL_BEGIN @class OFString; @class OFINIFile; +OF_SUBCLASSING_RESTRICTED @interface OFINIFileSettings: OFSettings { OFString *_filePath; OFINIFile *_INIFile; } @end OF_ASSUME_NONNULL_END Index: src/OFInflate64Stream.h ================================================================== --- src/OFInflate64Stream.h +++ src/OFInflate64Stream.h @@ -29,10 +29,11 @@ * underlying stream does so, too. * * @brief A class that handles Deflate decompression transparently for an * underlying stream. */ +OF_SUBCLASSING_RESTRICTED @interface OFInflate64Stream: OFStream { #ifdef OF_INFLATE64_STREAM_M @public #endif Index: src/OFInflateStream.h ================================================================== --- src/OFInflateStream.h +++ src/OFInflateStream.h @@ -29,10 +29,11 @@ * underlying stream does so, too. * * @brief A class that handles Deflate decompression transparently for an * underlying stream. */ +OF_SUBCLASSING_RESTRICTED @interface OFInflateStream: OFStream { #ifdef OF_INFLATE_STREAM_M @public #endif Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -44,10 +44,11 @@ @interface OFMethod: OFObject { SEL _selector; OFString *_name; const char *_typeEncoding; + OF_RESERVE_IVARS(4) } /*! * @brief The selector of the method. */ @@ -74,10 +75,11 @@ @interface OFProperty: OFObject { OFString *_name; unsigned int _attributes; OFString *_Nullable _getter, *_Nullable _setter, *_Nullable _iVar; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the property. */ @@ -128,10 +130,11 @@ @interface OFInstanceVariable: OFObject { OFString *_name; const char *_typeEncoding; ptrdiff_t _offset; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the instance variable. */ @@ -153,10 +156,11 @@ /*! * @class OFIntrospection OFIntrospection.h ObjFW/OFIntrospection.h * * @brief A class for introspecting classes. */ +OF_SUBCLASSING_RESTRICTED @interface OFIntrospection: OFObject { OFMutableArray OF_GENERIC(OFMethod *) *_classMethods; OFMutableArray OF_GENERIC(OFMethod *) *_instanceMethods; OFMutableArray OF_GENERIC(OFProperty *) *_properties; Index: src/OFInvertedCharacterSet.h ================================================================== --- src/OFInvertedCharacterSet.h +++ src/OFInvertedCharacterSet.h @@ -17,10 +17,11 @@ #import "OFCharacterSet.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFInvertedCharacterSet: OFCharacterSet { OFCharacterSet *_characterSet; bool (*_characterIsMember)(id, SEL, of_unichar_t); } Index: src/OFInvocation.h ================================================================== --- src/OFInvocation.h +++ src/OFInvocation.h @@ -31,10 +31,11 @@ @interface OFInvocation: OFObject { OFMethodSignature *_methodSignature; OFMutableArray OF_GENERIC(OFMutableData *) *_arguments; OFMutableData *_returnValue; + OF_RESERVE_IVARS(4) } /*! * @brief The method signature for the invocation. */ Index: src/OFKernelEventObserver.h ================================================================== --- src/OFKernelEventObserver.h +++ src/OFKernelEventObserver.h @@ -139,10 +139,11 @@ OFMutableData *_queueActions; OFMutableArray *_queueObjects; #ifdef OF_AMIGAOS ULONG _execSignalMask; #endif + OF_RESERVE_IVARS(4) } /*! * @brief The delegate for the OFKernelEventObserver. */ Index: src/OFKqueueKernelEventObserver.h ================================================================== --- src/OFKqueueKernelEventObserver.h +++ src/OFKqueueKernelEventObserver.h @@ -19,12 +19,13 @@ OF_ASSUME_NONNULL_BEGIN @class OFMutableArray OF_GENERIC(ObjectType); +OF_SUBCLASSING_RESTRICTED @interface OFKqueueKernelEventObserver: OFKernelEventObserver { int _kernelQueue; } @end OF_ASSUME_NONNULL_END Index: src/OFLHAArchive.h ================================================================== --- src/OFLHAArchive.h +++ src/OFLHAArchive.h @@ -27,10 +27,11 @@ /*! * @class OFLHAArchive OFLHAArchive.h ObjFW/OFLHAArchive.h * * @brief A class for accessing and manipulating LHA files. */ +OF_SUBCLASSING_RESTRICTED @interface OFLHAArchive: OFObject { OFStream *_stream; enum { OF_LHA_ARCHIVE_MODE_READ, Index: src/OFLHAArchiveEntry.h ================================================================== --- src/OFLHAArchiveEntry.h +++ src/OFLHAArchiveEntry.h @@ -45,10 +45,11 @@ OFString *_Nullable _fileComment; OFNumber *_Nullable _mode, *_Nullable _UID, *_Nullable _GID; OFString *_Nullable _owner, *_Nullable _group; OFDate *_Nullable _modificationDate; OFMutableArray OF_GENERIC(OFData *) *_extensions; + OF_RESERVE_IVARS(4) } /*! * @brief The file name of the entry. */ Index: src/OFLHADecompressingStream.h ================================================================== --- src/OFLHADecompressingStream.h +++ src/OFLHADecompressingStream.h @@ -19,10 +19,11 @@ OF_ASSUME_NONNULL_BEGIN #define OF_LHA_DECOMPRESSING_STREAM_BUFFER_SIZE 4096 +OF_SUBCLASSING_RESTRICTED @interface OFLHADecompressingStream: OFStream { @public OFStream *_stream; uint8_t _distanceBits, _dictionaryBits; Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -53,10 +53,11 @@ { of_list_object_t *_Nullable _firstListObject; of_list_object_t *_Nullable _lastListObject; size_t _count; unsigned long _mutations; + OF_RESERVE_IVARS(4) } /*! * @brief The first list object of the list. */ Index: src/OFLocale.h ================================================================== --- src/OFLocale.h +++ src/OFLocale.h @@ -41,10 +41,11 @@ /*! * @class OFLocale OFLocale.h ObjFW/OFLocale.h * * @brief A class for querying the locale and retrieving localized strings. */ +OF_SUBCLASSING_RESTRICTED @interface OFLocale: OFObject { OFString *_Nullable _language, *_Nullable _territory; of_string_encoding_t _encoding; OFString *_decimalPoint; Index: src/OFMD5Hash.h ================================================================== --- src/OFMD5Hash.h +++ src/OFMD5Hash.h @@ -24,10 +24,11 @@ /*! * @class OFMD5Hash OFMD5Hash.h ObjFW/OFMD5Hash.h * * @brief A class which provides methods to create an MD5 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFMD5Hash: OFObject { OFSecureData *_iVarsData; struct of_md5_hash_ivars { uint32_t state[4]; Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -68,10 +68,11 @@ * @class OFMapTable OFMapTable.h ObjFW/OFMapTable.h * * @brief A class similar to OFDictionary, but providing more options how keys * and objects should be retained, released, compared and hashed. */ +OF_SUBCLASSING_RESTRICTED @interface OFMapTable: OFObject { of_map_table_functions_t _keyFunctions, _objectFunctions; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; uint32_t _count, _capacity; Index: src/OFMapTableDictionary.h ================================================================== --- src/OFMapTableDictionary.h +++ src/OFMapTableDictionary.h @@ -20,14 +20,15 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; @class OFMapTableEnumerator; +OF_SUBCLASSING_RESTRICTED @interface OFMapTableDictionary: OFDictionary { OFMapTable *_mapTable; } - (instancetype)initWithCapacity: (size_t)capacity; @end OF_ASSUME_NONNULL_END Index: src/OFMapTableSet.h ================================================================== --- src/OFMapTableSet.h +++ src/OFMapTableSet.h @@ -19,14 +19,15 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; +OF_SUBCLASSING_RESTRICTED @interface OFMapTableSet: OFSet { OFMapTable *_mapTable; } - (instancetype)initWithCapacity: (size_t)capacity; @end OF_ASSUME_NONNULL_END Index: src/OFMessagePackExtension.h ================================================================== --- src/OFMessagePackExtension.h +++ src/OFMessagePackExtension.h @@ -31,10 +31,11 @@ @interface OFMessagePackExtension: OFObject { int8_t _type; OFData *_data; + OF_RESERVE_IVARS(4) } /*! * @brief The MessagePack extension type. */ Index: src/OFMethodSignature.h ================================================================== --- src/OFMethodSignature.h +++ src/OFMethodSignature.h @@ -28,10 +28,11 @@ */ @interface OFMethodSignature: OFObject { char *_types; OFMutableData *_typesPointers, *_offsets; + OF_RESERVE_IVARS(4) } /*! * @brief The number of arguments of the method. */ Index: src/OFMutableAdjacentArray.h ================================================================== --- src/OFMutableAdjacentArray.h +++ src/OFMutableAdjacentArray.h @@ -19,13 +19,14 @@ OF_ASSUME_NONNULL_BEGIN @class OFMutableData; +OF_SUBCLASSING_RESTRICTED @interface OFMutableAdjacentArray: OFMutableArray { OFMutableData *_array; unsigned long _mutations; } @end OF_ASSUME_NONNULL_END Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -44,10 +44,14 @@ */ @interface OFMutableArray OF_GENERIC(ObjectType): OFArray OF_GENERIC(ObjectType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Creates a new OFMutableArray with enough memory to hold the specified * number of objects. * * @param capacity The initial capacity for the OFMutableArray Index: src/OFMutableData.h ================================================================== --- src/OFMutableData.h +++ src/OFMutableData.h @@ -28,10 +28,11 @@ * @brief A class for storing and manipulating arbitrary data in an array. */ @interface OFMutableData: OFData { size_t _capacity; + OF_RESERVE_IVARS(4) } /*! * @brief All items of the OFMutableData as a C array. * Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -45,10 +45,14 @@ OFDictionary OF_GENERIC(KeyType, ObjectType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define KeyType id # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Creates a new OFMutableDictionary with enough memory to hold the * specified number of objects. * * @param capacity The initial capacity for the OFMutableDictionary Index: src/OFMutableLHAArchiveEntry.h ================================================================== --- src/OFMutableLHAArchiveEntry.h +++ src/OFMutableLHAArchiveEntry.h @@ -24,10 +24,13 @@ * OFMutableLHAArchiveEntry.h ObjFW/OFMutableLHAArchiveEntry.h * * @brief A class which represents a mutable entry in an LHA archive. */ @interface OFMutableLHAArchiveEntry: OFLHAArchiveEntry +{ + OF_RESERVE_IVARS(4) +} /*! * @brief The file name of the entry. */ @property (readwrite, copy, nonatomic) OFString *fileName; Index: src/OFMutableMapTableDictionary.h ================================================================== --- src/OFMutableMapTableDictionary.h +++ src/OFMutableMapTableDictionary.h @@ -19,12 +19,13 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; +OF_SUBCLASSING_RESTRICTED @interface OFMutableMapTableDictionary: OFMutableDictionary { OFMapTable *_mapTable; } @end OF_ASSUME_NONNULL_END Index: src/OFMutableMapTableSet.h ================================================================== --- src/OFMutableMapTableSet.h +++ src/OFMutableMapTableSet.h @@ -19,12 +19,13 @@ OF_ASSUME_NONNULL_BEGIN @class OFMapTable; +OF_SUBCLASSING_RESTRICTED @interface OFMutableMapTableSet: OFMutableSet { OFMapTable *_mapTable; } @end OF_ASSUME_NONNULL_END Index: src/OFMutablePair.h ================================================================== --- src/OFMutablePair.h +++ src/OFMutablePair.h @@ -28,10 +28,14 @@ OFPair OF_GENERIC(FirstType, SecondType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define FirstType id # define SecondType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The first object of the pair. */ @property (readwrite, nonatomic, retain) FirstType firstObject; Index: src/OFMutableSet.h ================================================================== --- src/OFMutableSet.h +++ src/OFMutableSet.h @@ -29,10 +29,14 @@ */ @interface OFMutableSet OF_GENERIC(ObjectType): OFSet OF_GENERIC(ObjectType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Creates a new OFMutableSet with enough memory to hold the specified * number of objects. * * @param capacity The initial capacity for the OFMutableSet Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -23,10 +23,14 @@ * @class OFMutableString OFString.h ObjFW/OFString.h * * @brief A class for storing and modifying strings. */ @interface OFMutableString: OFString +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Sets the character at the specified index. * * @param character The character to set * @param index The index where to set the character Index: src/OFMutableTarArchiveEntry.h ================================================================== --- src/OFMutableTarArchiveEntry.h +++ src/OFMutableTarArchiveEntry.h @@ -24,10 +24,13 @@ * OFMutableTarArchiveEntry.h ObjFW/OFMutableTarArchiveEntry.h * * @brief A class which represents a mutable entry of a tar archive. */ @interface OFMutableTarArchiveEntry: OFTarArchiveEntry +{ + OF_RESERVE_IVARS(4) +} /*! * @brief The file name of the entry. */ @property (readwrite, copy, nonatomic) OFString *fileName; Index: src/OFMutableTriple.h ================================================================== --- src/OFMutableTriple.h +++ src/OFMutableTriple.h @@ -29,10 +29,14 @@ #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define FirstType id # define SecondType id # define ThirdType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The first object of the triple. */ @property (readwrite, nonatomic, retain) FirstType firstObject; Index: src/OFMutableURL.h ================================================================== --- src/OFMutableURL.h +++ src/OFMutableURL.h @@ -23,10 +23,14 @@ * @class OFMutableURL OFMutableURL.h ObjFW/OFMutableURL.h * * @brief A class for parsing URLs and accessing parts of it. */ @interface OFMutableURL: OFURL +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The scheme part of the URL. */ @property OF_NULLABLE_PROPERTY (readwrite, copy, nonatomic) OFString *scheme; Index: src/OFMutableUTF8String.h ================================================================== --- src/OFMutableUTF8String.h +++ src/OFMutableUTF8String.h @@ -18,14 +18,15 @@ #import "OFMutableString.h" #import "OFUTF8String.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFMutableUTF8String: OFMutableString { @public struct of_string_utf8_ivars *restrict _s; struct of_string_utf8_ivars _storage; } @end OF_ASSUME_NONNULL_END Index: src/OFMutableZIPArchiveEntry.h ================================================================== --- src/OFMutableZIPArchiveEntry.h +++ src/OFMutableZIPArchiveEntry.h @@ -25,10 +25,13 @@ * * @brief A class which represents a mutable entry in the central directory of * a ZIP archive. */ @interface OFMutableZIPArchiveEntry: OFZIPArchiveEntry +{ + OF_RESERVE_IVARS(4) +} /*! * @brief The file name of the entry. */ @property (readwrite, copy, nonatomic) OFString *fileName; Index: src/OFMutex.h ================================================================== --- src/OFMutex.h +++ src/OFMutex.h @@ -30,10 +30,11 @@ @interface OFMutex: OFObject { of_mutex_t _mutex; bool _initialized; OFString *_Nullable _name; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new mutex. * Index: src/OFNonretainedObjectValue.h ================================================================== --- src/OFNonretainedObjectValue.h +++ src/OFNonretainedObjectValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFNonretainedObjectValue: OFValue { id _object; } @end OF_ASSUME_NONNULL_END Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -114,10 +114,11 @@ /*! * @class OFNumber OFNumber.h ObjFW/OFNumber.h * * @brief Provides a way to store a number in an object. */ +OF_SUBCLASSING_RESTRICTED @interface OFNumber: OFValue { union of_number_value { bool bool_; 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/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -64,10 +64,11 @@ /*! * @class OFOptionsParser OFOptionsParser.h ObjFW/OFOptionsParser.h * * @brief A class for parsing the program options specified on the command line. */ +OF_SUBCLASSING_RESTRICTED @interface OFOptionsParser: OFObject { of_options_parser_option_t *_options; OFMapTable *_longOptions; OFArray OF_GENERIC(OFString *) *_arguments; Index: src/OFPair.h ================================================================== --- src/OFPair.h +++ src/OFPair.h @@ -31,10 +31,11 @@ # define SecondType id #endif { FirstType _Nullable _firstObject; SecondType _Nullable _secondObject; + OF_RESERVE_IVARS(4) } /*! * @brief The first object of the pair. */ Index: src/OFPlugin.h ================================================================== --- src/OFPlugin.h +++ src/OFPlugin.h @@ -39,10 +39,11 @@ * @brief Provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { of_plugin_handle_t _handle; + OF_RESERVE_IVARS(4) } /*! * @brief Loads a plugin from a file. * Index: src/OFPointValue.h ================================================================== --- src/OFPointValue.h +++ src/OFPointValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFPointValue: OFValue { of_point_t _point; } @end OF_ASSUME_NONNULL_END Index: src/OFPointerValue.h ================================================================== --- src/OFPointerValue.h +++ src/OFPointerValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFPointerValue: OFValue { void *_pointer; } @end OF_ASSUME_NONNULL_END Index: src/OFPollKernelEventObserver.h ================================================================== --- src/OFPollKernelEventObserver.h +++ src/OFPollKernelEventObserver.h @@ -19,14 +19,15 @@ OF_ASSUME_NONNULL_BEGIN @class OFMutableData; +OF_SUBCLASSING_RESTRICTED @interface OFPollKernelEventObserver: OFKernelEventObserver { OFMutableData *_FDs; int _maxFD; id __unsafe_unretained *_FDToObject; } @end OF_ASSUME_NONNULL_END Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -44,10 +44,11 @@ /*! * @class OFProcess OFProcess.h ObjFW/OFProcess.h * * @brief A class for stream-like communication with a newly created process. */ +OF_SUBCLASSING_RESTRICTED @interface OFProcess: OFStream #ifndef OF_WINDOWS #endif { Index: src/OFRIPEMD160Hash.h ================================================================== --- src/OFRIPEMD160Hash.h +++ src/OFRIPEMD160Hash.h @@ -24,10 +24,11 @@ /*! * @class OFRIPEMD160Hash OFRIPEMD160Hash.h ObjFW/OFRIPEMD160Hash.h * * @brief A class which provides methods to create a RIPEMD-160 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFRIPEMD160Hash: OFObject { OFSecureData *_iVarsData; struct of_ripemd160_hash_ivars { uint32_t state[5]; Index: src/OFRangeCharacterSet.h ================================================================== --- src/OFRangeCharacterSet.h +++ src/OFRangeCharacterSet.h @@ -17,12 +17,13 @@ #import "OFCharacterSet.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFRangeCharacterSet: OFCharacterSet { of_range_t _range; } @end OF_ASSUME_NONNULL_END Index: src/OFRangeValue.h ================================================================== --- src/OFRangeValue.h +++ src/OFRangeValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFRangeValue: OFValue { of_range_t _range; } @end OF_ASSUME_NONNULL_END Index: src/OFRectangleValue.h ================================================================== --- src/OFRectangleValue.h +++ src/OFRectangleValue.h @@ -17,12 +17,13 @@ #import "OFValue.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFRectangleValue: OFValue { of_rectangle_t _rectangle; } @end OF_ASSUME_NONNULL_END Index: src/OFRecursiveMutex.h ================================================================== --- src/OFRecursiveMutex.h +++ src/OFRecursiveMutex.h @@ -26,10 +26,11 @@ * @class OFRecursiveMutex OFRecursiveMutex.h ObjFW/OFRecursiveMutex.h * * @brief A class for creating mutual exclusions which can be entered * recursively. */ +OF_SUBCLASSING_RESTRICTED @interface OFRecursiveMutex: OFObject { of_rmutex_t _rmutex; bool _initialized; OFString *_Nullable _name; Index: src/OFRunLoop.h ================================================================== --- src/OFRunLoop.h +++ src/OFRunLoop.h @@ -57,10 +57,11 @@ /*! * @class OFRunLoop OFRunLoop.h ObjFW/OFRunLoop.h * * @brief A class providing a run loop for the application and its processes. */ +OF_SUBCLASSING_RESTRICTED @interface OFRunLoop: OFObject { OFMutableDictionary *_states; #ifdef OF_HAVE_THREADS OFMutex *_statesMutex; Index: src/OFSHA1Hash.h ================================================================== --- src/OFSHA1Hash.h +++ src/OFSHA1Hash.h @@ -24,10 +24,11 @@ /*! * @class OFSHA1Hash OFSHA1Hash.h ObjFW/OFSHA1Hash.h * * @brief A class which provides methods to create an SHA-1 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFSHA1Hash: OFObject { OFSecureData *_iVarsData; struct of_sha1_hash_ivars { uint32_t state[5]; Index: src/OFSHA224Hash.h ================================================================== --- src/OFSHA224Hash.h +++ src/OFSHA224Hash.h @@ -22,9 +22,10 @@ /*! * @class OFSHA224Hash OFSHA224Hash.h ObjFW/OFSHA224Hash.h * * @brief A class which provides methods to create an SHA-224 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFSHA224Hash: OFSHA224Or256Hash @end OF_ASSUME_NONNULL_END Index: src/OFSHA224Or256Hash.h ================================================================== --- src/OFSHA224Or256Hash.h +++ src/OFSHA224Or256Hash.h @@ -37,9 +37,10 @@ uint32_t words[64]; } buffer; size_t bufferLength; } *_iVars; bool _calculated; + OF_RESERVE_IVARS(4) } @end OF_ASSUME_NONNULL_END Index: src/OFSHA256Hash.h ================================================================== --- src/OFSHA256Hash.h +++ src/OFSHA256Hash.h @@ -22,9 +22,10 @@ /*! * @class OFSHA256Hash OFSHA256Hash.h ObjFW/OFSHA256Hash.h * * @brief A class which provides methods to create an SHA-256 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFSHA256Hash: OFSHA224Or256Hash @end OF_ASSUME_NONNULL_END Index: src/OFSHA384Hash.h ================================================================== --- src/OFSHA384Hash.h +++ src/OFSHA384Hash.h @@ -22,9 +22,10 @@ /*! * @class OFSHA384Hash OFSHA384Hash.h ObjFW/OFSHA384Hash.h * * @brief A class which provides methods to create an SHA-384 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFSHA384Hash: OFSHA384Or512Hash @end OF_ASSUME_NONNULL_END Index: src/OFSHA384Or512Hash.h ================================================================== --- src/OFSHA384Or512Hash.h +++ src/OFSHA384Or512Hash.h @@ -37,9 +37,10 @@ uint64_t words[80]; } buffer; size_t bufferLength; } *_iVars; bool _calculated; + OF_RESERVE_IVARS(4) } @end OF_ASSUME_NONNULL_END Index: src/OFSHA512Hash.h ================================================================== --- src/OFSHA512Hash.h +++ src/OFSHA512Hash.h @@ -22,9 +22,10 @@ /*! * @class OFSHA512Hash OFSHA512Hash.h ObjFW/OFSHA512Hash.h * * @brief A class which provides methods to create an SHA-512 hash. */ +OF_SUBCLASSING_RESTRICTED @interface OFSHA512Hash: OFSHA384Or512Hash @end OF_ASSUME_NONNULL_END Index: src/OFSandbox.h ================================================================== --- src/OFSandbox.h +++ src/OFSandbox.h @@ -69,10 +69,11 @@ unsigned int _allowsUnveil: 1; unsigned int _returnsErrors: 1; OFMutableArray OF_GENERIC(of_sandbox_unveil_path_t) *_unveiledPaths; @public size_t _unveiledPathsIndex; + OF_RESERVE_IVARS(4) } /*! * @brief Allows IO operations on previously allocated file descriptors. */ Index: src/OFSecureData.h ================================================================== --- src/OFSecureData.h +++ src/OFSecureData.h @@ -26,10 +26,11 @@ * it when it gets deallocated. * * @note Secure memory might be unavailable on the platform, in which case this * falls back to insecure (potentially swappable) memory. */ +OF_SUBCLASSING_RESTRICTED @interface OFSecureData: OFData { struct page *_page; } Index: src/OFSeekableStream.h ================================================================== --- src/OFSeekableStream.h +++ src/OFSeekableStream.h @@ -54,10 +54,14 @@ * and makes it work together with the caching of OFStream. If you * override this methods without the `lowlevel` prefix, you *will* break * caching, get broken results and seek to the wrong position! */ @interface OFSeekableStream: OFStream +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief Seeks to the specified absolute offset. * * @param offset The offset in bytes * @param whence From where to seek.@n Index: src/OFSelectKernelEventObserver.h ================================================================== --- src/OFSelectKernelEventObserver.h +++ src/OFSelectKernelEventObserver.h @@ -30,13 +30,14 @@ #import "OFKernelEventObserver.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFSelectKernelEventObserver: OFKernelEventObserver { fd_set _readFDs, _writeFDs; int _maxFD; } @end OF_ASSUME_NONNULL_END Index: src/OFSet.h ================================================================== --- src/OFSet.h +++ src/OFSet.h @@ -67,10 +67,14 @@ @interface OFSet OF_GENERIC(ObjectType): OFObject #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief An array of all objects in the set. */ @property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects; Index: src/OFSettings.h ================================================================== --- src/OFSettings.h +++ src/OFSettings.h @@ -34,10 +34,11 @@ * @brief A class for storing and retrieving settings */ @interface OFSettings: OFObject { OFString *_applicationName; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the application whose settings are accessed by the * instance. Index: src/OFSortedList.h ================================================================== --- src/OFSortedList.h +++ src/OFSortedList.h @@ -29,10 +29,14 @@ */ @interface OFSortedList OF_GENERIC(ObjectType): OFList OF_GENERIC(ObjectType) #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN) # define ObjectType id #endif +{ + OF_RESERVE_IVARS(4) +} + - (of_list_object_t *)appendObject: (ObjectType)object OF_UNAVAILABLE; - (of_list_object_t *)prependObject: (ObjectType)object OF_UNAVAILABLE; - (of_list_object_t *)insertObject: (ObjectType)object beforeListObject: (of_list_object_t *)listObject OF_UNAVAILABLE; Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -204,10 +204,11 @@ size_t _readBufferLength, _writeBufferLength; bool _writeBuffered, _waitingForDelimiter; @protected bool _blocking; id _Nullable _delegate; + OF_RESERVE_IVARS(4) } /*! * @brief Whether the end of the stream has been reached. */ @@ -280,13 +281,13 @@ * @brief Asynchronously reads *at most* size bytes from the stream into a * buffer. * * On network streams, this might read less than the specified number of bytes. * If you want to read exactly the specified number of bytes, use - * @ref asyncReadIntoBuffer:exactLength:target:selector:context:. Note that a - * read can even return 0 bytes - this does not necessarily mean that the - * stream ended, so you still need to check @ref atEndOfStream. + * @ref asyncReadIntoBuffer:exactLength:. Note that a read can even return 0 + * bytes - this does not necessarily mean that the stream ended, so you still + * need to check @ref atEndOfStream. * * @note The stream must conform to @ref OFReadyForReadingObserving in order * for this to work! * * @param buffer The buffer into which the data is read. @@ -301,13 +302,13 @@ * @brief Asynchronously reads *at most* size bytes from the stream into a * buffer. * * On network streams, this might read less than the specified number of bytes. * If you want to read exactly the specified number of bytes, use - * @ref asyncReadIntoBuffer:exactLength:target:selector:context:. Note that a - * read can even return 0 bytes - this does not necessarily mean that the - * stream ended, so you still need to check @ref atEndOfStream. + * @ref asyncReadIntoBuffer:exactLength:. Note that a read can even return 0 + * bytes - this does not necessarily mean that the stream ended, so you still + * need to check @ref atEndOfStream. * * @note The stream must conform to @ref OFReadyForReadingObserving in order * for this to work! * * @param buffer The buffer into which the data is read. @@ -322,14 +323,14 @@ /*! * @brief Asynchronously reads exactly the specified length bytes from the * stream into a buffer. * - * Unlike @ref asyncReadIntoBuffer:length:target:selector:context:, this method - * does not call the method when less than the specified length has been read - - * instead, it waits until it got exactly the specified length, the stream has - * ended or an exception occurred. + * Unlike @ref asyncReadIntoBuffer:length:, this method does not call the + * method when less than the specified length has been read - instead, it waits + * until it got exactly the specified length, the stream has ended or an + * exception occurred. * * @note The stream must conform to @ref OFReadyForReadingObserving in order * for this to work! * * @param buffer The buffer into which the data is read @@ -341,14 +342,14 @@ /*! * @brief Asynchronously reads exactly the specified length bytes from the * stream into a buffer. * - * Unlike @ref asyncReadIntoBuffer:length:target:selector:context:, this method - * does not call the method when less than the specified length has been read - - * instead, it waits until it got exactly the specified length, the stream has - * ended or an exception occurred. + * Unlike @ref asyncReadIntoBuffer:length:, this method does not call the + * method when less than the specified length has been read - instead, it waits + * until it got exactly the specified length, the stream has ended or an + * exception occurred. * * @note The stream must conform to @ref OFReadyForReadingObserving in order * for this to work! * * @param buffer The buffer into which the data is read Index: src/OFStreamSocket.h ================================================================== --- src/OFStreamSocket.h +++ src/OFStreamSocket.h @@ -29,10 +29,11 @@ @interface OFStreamSocket: OFStream { of_socket_t _socket; bool _atEndOfStream; + OF_RESERVE_IVARS(4) } /*! * @brief Returns a new, autoreleased OFTCPSocket. * Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -119,10 +119,14 @@ * * @brief A class for handling strings. */ @interface OFString: OFObject +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The length of the string in Unicode codepoints. */ @property (readonly, nonatomic) size_t length; Index: src/OFSystemInfo.h ================================================================== --- src/OFSystemInfo.h +++ src/OFSystemInfo.h @@ -23,10 +23,11 @@ /*! * @class OFSystemInfo OFSystemInfo.h ObjFW/OFSystemInfo.h * * @brief A class for querying information about the system. */ +OF_SUBCLASSING_RESTRICTED @interface OFSystemInfo: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) size_t pageSize; @property (class, readonly, nonatomic) size_t numberOfCPUs; @property (class, readonly, nonatomic) OFString *ObjFWVersion; Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -102,10 +102,11 @@ OFString *_Nullable _SOCKS5Host; uint16_t _SOCKS5Port; #ifdef OF_WII uint16_t _port; #endif + OF_RESERVE_IVARS(4) } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, nullable, copy, nonatomic) OFString *SOCKS5Host; @property (class, nonatomic) uint16_t SOCKS5Port; Index: src/OFTarArchive.h ================================================================== --- src/OFTarArchive.h +++ src/OFTarArchive.h @@ -27,10 +27,11 @@ /*! * @class OFTarArchive OFTarArchive.h ObjFW/OFTarArchive.h * * @brief A class for accessing and manipulating tar archives. */ +OF_SUBCLASSING_RESTRICTED @interface OFTarArchive: OFObject { OFStream *_stream; enum { OF_TAR_ARCHIVE_MODE_READ, Index: src/OFTarArchiveEntry.h ================================================================== --- src/OFTarArchiveEntry.h +++ src/OFTarArchiveEntry.h @@ -59,10 +59,11 @@ OFDate *_modificationDate; of_tar_archive_entry_type_t _type; OFString *_Nullable _targetFileName; OFString *_Nullable _owner, *_Nullable _group; uint32_t _deviceMajor, _deviceMinor; + OF_RESERVE_IVARS(4) } /*! * @brief The file name of the entry. */ Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -51,12 +51,12 @@ * To use it, you should create a new class derived from it and reimplement * main. * * @warning Some operating systems such as AmigaOS need special per-thread * initialization of sockets. If you intend to use sockets in the - * thread, set the @ref usesSockets property to true before starting - * it. + * thread, set the @ref supportsSockets property to true before + * starting it. * * @warning Even though the OFCopying protocol is implemented, it does *not* * return an independent copy of the thread, but instead retains it. * This is so that the thread can be used as a key for a dictionary, * so context can be associated with a thread. @@ -88,10 +88,11 @@ @private OFString *_Nullable _name; # ifdef OF_HAVE_SOCKETS OFDNSResolver *_DNSResolver; # endif + OF_RESERVE_IVARS(4) } #endif #ifdef OF_HAVE_CLASS_PROPERTIES # ifdef OF_HAVE_THREADS 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/OFThreadPool.h ================================================================== --- src/OFThreadPool.h +++ src/OFThreadPool.h @@ -39,10 +39,11 @@ * @brief A class providing a pool of reusable threads. * * @note When the thread pool is released, all threads will terminate after * they finish the job they are currently processing. */ +OF_SUBCLASSING_RESTRICTED @interface OFThreadPool: OFObject { size_t _size; OFMutableArray *_threads; volatile int _count; Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -40,10 +40,11 @@ /*! * @class OFTimer OFTimer.h ObjFW/OFTimer.h * * @brief A class for creating and firing timers. */ +OF_SUBCLASSING_RESTRICTED @interface OFTimer: OFObject { OFDate *_fireDate; of_time_interval_t _interval; id _target; Index: src/OFTriple.h ================================================================== --- src/OFTriple.h +++ src/OFTriple.h @@ -33,10 +33,11 @@ #endif { FirstType _Nullable _firstObject; SecondType _Nullable _secondObject; ThirdType _Nullable _thirdObject; + OF_RESERVE_IVARS(4) } /*! * @brief The first object of the triple. */ Index: src/OFUDPSocket.h ================================================================== --- src/OFUDPSocket.h +++ src/OFUDPSocket.h @@ -123,10 +123,11 @@ #ifdef OF_WII uint16_t _port; #endif bool _blocking; id _Nullable _delegate; + OF_RESERVE_IVARS(4) } /*! * @brief Whether the socket is in blocking mode. * Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -35,10 +35,11 @@ OFString *_Nullable _URLEncodedScheme, *_Nullable _URLEncodedHost; OFNumber *_Nullable _port; OFString *_Nullable _URLEncodedUser, *_Nullable _URLEncodedPassword; OFString *_Nullable _URLEncodedPath; OFString *_Nullable _URLEncodedQuery, *_Nullable _URLEncodedFragment; + OF_RESERVE_IVARS(4) } /*! * @brief The scheme part of the URL. */ Index: src/OFURLHandler.h ================================================================== --- src/OFURLHandler.h +++ src/OFURLHandler.h @@ -32,10 +32,11 @@ * @brief A handler for a URL scheme. */ @interface OFURLHandler: OFObject { OFString *_scheme; + OF_RESERVE_IVARS(4) } /*! * @brief The scheme this OFURLHandler handles. */ Index: src/OFValue.h ================================================================== --- src/OFValue.h +++ src/OFValue.h @@ -23,10 +23,14 @@ * @class OFValue OFValue.h ObjFW/OFValue.h * * @brief A class for storing arbitrary values in an object. */ @interface OFValue: OFObject +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The ObjC type encoding of the value. */ @property (readonly, nonatomic) const char *objCType; Index: src/OFWin32ConsoleStdIOStream.h ================================================================== --- src/OFWin32ConsoleStdIOStream.h +++ src/OFWin32ConsoleStdIOStream.h @@ -19,10 +19,11 @@ #import "OFStdIOStream.h" OF_ASSUME_NONNULL_BEGIN +OF_SUBCLASSING_RESTRICTED @interface OFWin32ConsoleStdIOStream: OFStdIOStream { HANDLE _handle; of_char16_t _incompleteUTF16Surrogate; char _incompleteUTF8Surrogate[4]; Index: src/OFWindowsRegistryKey.h ================================================================== --- src/OFWindowsRegistryKey.h +++ src/OFWindowsRegistryKey.h @@ -26,10 +26,11 @@ /*! * @class OFWindowsRegistryKey \ * OFWindowsRegistryKey.h ObjFW/OFWindowsRegistryKey.h */ +OF_SUBCLASSING_RESTRICTED @interface OFWindowsRegistryKey: OFObject { HKEY _hKey; bool _close; } Index: src/OFXMLAttribute.h ================================================================== --- src/OFXMLAttribute.h +++ src/OFXMLAttribute.h @@ -31,10 +31,11 @@ #if defined(OF_XML_ELEMENT_M) || defined(OF_XML_PARSER_M) @public #endif OFString *_name, *_Nullable _namespace, *_stringValue; bool _useDoubleQuotes; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the attribute. */ Index: src/OFXMLCDATA.h ================================================================== --- src/OFXMLCDATA.h +++ src/OFXMLCDATA.h @@ -25,10 +25,11 @@ * @brief A class representing XML CDATA. */ @interface OFXMLCDATA: OFXMLNode { OFString *_CDATA; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new OFXMLCDATA with the specified string. * Index: src/OFXMLCharacters.h ================================================================== --- src/OFXMLCharacters.h +++ src/OFXMLCharacters.h @@ -25,10 +25,11 @@ * @brief A class representing XML characters. */ @interface OFXMLCharacters: OFXMLNode { OFString *_characters; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new OFXMLCharacters with the specified string. * Index: src/OFXMLComment.h ================================================================== --- src/OFXMLComment.h +++ src/OFXMLComment.h @@ -25,10 +25,11 @@ * @brief A class for representing XML comments. */ @interface OFXMLComment: OFXMLNode { OFString *_comment; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new OFXMLComment with the specified string. * Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -36,10 +36,11 @@ OFString *_name, *_Nullable _namespace, *_Nullable _defaultNamespace; OFMutableArray OF_GENERIC(OFXMLAttribute *) *_Nullable _attributes; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _namespaces; OFMutableArray OF_GENERIC(OFXMLNode *) *_Nullable _children; + OF_RESERVE_IVARS(4) } /*! * @brief The name of the element. */ Index: src/OFXMLElementBuilder.h ================================================================== --- src/OFXMLElementBuilder.h +++ src/OFXMLElementBuilder.h @@ -102,10 +102,11 @@ * * It can also be used to build OFXMLElements from parts of the document by * first parsing stuff using the OFXMLParser with another delegate and then * setting the OFXMLElementBuilder as delegate for the parser. */ +OF_SUBCLASSING_RESTRICTED @interface OFXMLElementBuilder: OFObject { OFMutableArray OF_GENERIC(OFXMLElement *) *_stack; id _Nullable _delegate; } Index: src/OFXMLNode.h ================================================================== --- src/OFXMLNode.h +++ src/OFXMLNode.h @@ -26,10 +26,14 @@ * @class OFXMLNode OFXMLNode.h ObjFW/OFXMLNode.h * * @brief A class which stores an XML element. */ @interface OFXMLNode: OFObject +{ + OF_RESERVE_IVARS(4) +} + /*! * @brief The contents of the node as a string value. * * For an @ref OFXMLElement, setting it removes all children and creates a * single child with the specified string value. Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -127,10 +127,11 @@ * @brief An event-based XML parser. * * OFXMLParser is an event-based XML parser which calls the delegate's callbacks * as soon as it finds something, thus suitable for streams as well. */ +OF_SUBCLASSING_RESTRICTED @interface OFXMLParser: OFObject { id _Nullable _delegate; enum of_xml_parser_state { OF_XMLPARSER_IN_BYTE_ORDER_MARK, Index: src/OFXMLProcessingInstructions.h ================================================================== --- src/OFXMLProcessingInstructions.h +++ src/OFXMLProcessingInstructions.h @@ -26,10 +26,11 @@ * @brief A class for representing XML processing instructions. */ @interface OFXMLProcessingInstructions: OFXMLNode { OFString *_processingInstructions; + OF_RESERVE_IVARS(4) } /*! * @brief Creates a new OFXMLProcessingInstructions with the specified string. * Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -29,10 +29,11 @@ /*! * @class OFZIPArchive OFZIPArchive.h ObjFW/OFZIPArchive.h * * @brief A class for accessing and manipulating ZIP files. */ +OF_SUBCLASSING_RESTRICTED @interface OFZIPArchive: OFObject { OFStream *_stream; int64_t _offset; enum { Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -110,10 +110,11 @@ OFString *_Nullable _fileComment; uint32_t _startDiskNumber; uint16_t _internalAttributes; uint32_t _versionSpecificAttributes; int64_t _localFileHeaderOffset; + OF_RESERVE_IVARS(4) } /*! * @brief The file name of the entry. */ 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: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -122,10 +122,25 @@ # else # /* Hopefully no arch needs more than 16 byte alignment */ # define OF_BIGGEST_ALIGNMENT 16 # endif #endif + +#define OF_PREPROCESSOR_CONCAT2(a, b) a##b +#define OF_PREPROCESSOR_CONCAT(a, b) OF_PREPROCESSOR_CONCAT2(a, b) + +#if __OBJFW_RUNTIME_ABI__ || (defined(OF_APPLE_RUNTIME) && defined(__OBJC2__)) +# define OF_HAVE_NONFRAGILE_IVARS +#endif + +#ifdef OF_HAVE_NONFRAGILE_IVARS +# define OF_RESERVE_IVARS(num) +#else +# define OF_RESERVE_IVARS(num) \ + @private \ + void *OF_PREPROCESSOR_CONCAT(_reserved, __COUNTER__)[num]; +#endif #ifdef __GNUC__ # define OF_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #else # define OF_GCC_VERSION 0 @@ -403,12 +418,10 @@ abort(); \ \ [super dealloc]; /* Get rid of a stupid warning */ #endif -#define OF_PREPROCESSOR_CONCAT2(a, b) a##b -#define OF_PREPROCESSOR_CONCAT(a, b) OF_PREPROCESSOR_CONCAT2(a, b) #define OF_CONSTRUCTOR(prio) \ static void __attribute__((__constructor__(prio))) \ OF_PREPROCESSOR_CONCAT(constructor, __LINE__)(void) #define OF_DESTRUCTOR(prio) \ static void __attribute__((__destructor__(prio))) \ 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/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; @@ -309,8 +309,8 @@ TEST(@"-[getArgument:atIndex:] #4", R([invocation getArgument: &st2 atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) - [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 (;;) {