Index: src/OFAutoreleasePool.h ================================================================== --- src/OFAutoreleasePool.h +++ src/OFAutoreleasePool.h @@ -71,12 +71,9 @@ * \brief Releases all objects in the autorelease pool and deallocates the pool. */ - (void)release; /** - * \brief Tells the garbage collector that now is a good time to clean up. - * - * If there is no garbage collector, calling drain is equivalent to calling - * release. + * \brief Releases all objects in the autorelease pool and deallocates the pool. */ - (void)drain; @end Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -681,18 +681,10 @@ if (closable && fileDescriptor != -1) close(fileDescriptor); [super dealloc]; } - -- (void)finalize -{ - if (closable && fileDescriptor != -1) - close(fileDescriptor); - - [super finalize]; -} @end @implementation OFFileSingleton - initWithPath: (OFString*)path mode: (OFString*)mode Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -553,28 +553,15 @@ - (void)freeMemory: (void*)pointer; /** * \brief Deallocates the object. * - * It is automatically called when the retain count reaches zero, but not when - * the garbage collector disposes of the object (see finalize). + * It is automatically called when the retain count reaches zero. * * This also frees all memory in its memory pool. */ - (void)dealloc; - -/** - * \brief A method which is called before the garbage collector disposes of the - * object. - * - * This is useful for example to close files if they haven't been closed by the - * user yet. - * - * Note: Currently, there is no garbage collector. This method only exists to - * make it easy to add support for a garbage collector later. - */ -- (void)finalize; @end /** * \brief A protocol for the creation of copies. */ Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -1082,37 +1082,10 @@ free(PRE_IVAR->memoryChunks); free((char*)self - PRE_IVAR_ALIGN); } -- (void)finalize -{ - Class class; - void (*last)(id, SEL) = NULL; - void **iter; - - for (class = isa; class != Nil; class = class_getSuperclass(class)) { - void (*destruct)(id, SEL); - - if ([class instancesRespondToSelector: cxx_destruct]) { - if ((destruct = (void(*)(id, SEL))[class - instanceMethodForSelector: cxx_destruct]) != last) - destruct(self, cxx_destruct); - - last = destruct; - } else - break; - } - - iter = PRE_IVAR->memoryChunks + PRE_IVAR->memoryChunksSize; - while (iter-- > PRE_IVAR->memoryChunks) - free(*iter); - - if (PRE_IVAR->memoryChunks != NULL) - free(PRE_IVAR->memoryChunks); -} - /* Required to use properties with the Apple runtime */ - copyWithZone: (void*)zone { if (zone != NULL) @throw [OFNotImplementedException newWithClass: isa Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -82,13 +82,6 @@ [super dealloc]; dlclose(h); } - -- (void)finalize -{ - dlclose(handle); - - [super finalize]; -} @end Index: src/OFStreamObserver.m ================================================================== --- src/OFStreamObserver.m +++ src/OFStreamObserver.m @@ -154,18 +154,10 @@ #endif [super dealloc]; } -- (void)finalize -{ - close(cancelFD[0]); - close(cancelFD[1]); - - [super finalize]; -} - - (id )delegate { OF_GETTER(delegate, YES) } Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -166,14 +166,6 @@ if (sock != INVALID_SOCKET) [self close]; [super dealloc]; } - -- (void)finalize -{ - if (sock != INVALID_SOCKET) - [self close]; - - [super finalize]; -} @end Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -356,26 +356,10 @@ [object release]; [returnValue release]; [super dealloc]; } - -- (void)finalize -{ - if (running == OF_THREAD_RUNNING) - @throw [OFThreadStillRunningException newWithClass: isa - thread: self]; - - /* - * We should not be running anymore, but call detach in order to free - * the resources. - */ - if (running == OF_THREAD_WAITING_FOR_JOIN) - of_thread_detach(thread); - - [super finalize]; -} @end @implementation OFTLSKey + (void)initialize { @@ -454,28 +438,10 @@ } } [super dealloc]; } - -- (void)finalize -{ - if (destructor != NULL) - destructor(self); - - if (initialized) - of_tlskey_free(key); - - /* In case we called [self release] in init */ - if (listObject != NULL) { - @synchronized (TLSKeys) { - [TLSKeys removeListObject: listObject]; - } - } - - [super finalize]; -} @end @implementation OFMutex + mutex { @@ -523,20 +489,10 @@ @throw [OFMutexStillLockedException newWithClass: isa mutex: self]; [super dealloc]; } - -- (void)finalize -{ - if (initialized) - if (!of_mutex_free(&mutex)) - @throw [OFMutexStillLockedException newWithClass: isa - mutex: self]; - - [super finalize]; -} @end @implementation OFCondition + condition { @@ -587,17 +543,6 @@ newWithClass: isa condition: self]; [super dealloc]; } - -- (void)finalize -{ - if (conditionInitialized) - if (!of_condition_free(&condition)) - @throw [OFConditionStillWaitingException - newWithClass: isa - condition: self]; - - [super finalize]; -} @end