Index: src/OFConstString.m ================================================================== --- src/OFConstString.m +++ src/OFConstString.m @@ -35,11 +35,11 @@ { } - (size_t)retainCount { - return 1; + return SIZE_MAX; } - autorelease { return self; Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -15,11 +15,11 @@ /** * An exception indicating an object could not be allocated. * * This exception is preallocated, as if there's no memory, no exception can * be allocated of course. That's why you shouldn't and even can't deallocate - *it. + * it. * * This is the only exception that is not an OFException as it's special. * It does not know for which class allocation failed and it should not be * handled like other exceptions, as the exception handling code is not * allowed to allocate ANY memory. Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -223,10 +223,30 @@ /** * Deallocates the object and also frees all memory allocated via its memory * pool. */ - (void)dealloc; + +/* + * Those are needed as the root class is the superclass of the root class's + * metaclass and thus instance methods can be sent to class objects as well. + */ ++ addMemoryToPool: (void*)ptr; ++ (void*)allocMemoryWithSize: (size_t)size; ++ (void*)allocMemoryForNItems: (size_t)nitems + withSize: (size_t)size; ++ (void*)resizeMemory: (void*)ptr + toSize: (size_t)size; ++ (void*)resizeMemory: (void*)ptr + toNItems: (size_t)nitems + withSize: (size_t)size; ++ freeMemory: (void*)ptr; ++ retain; ++ autorelease; ++ (size_t)retainCount; ++ (void)release; ++ (void)dealloc; @end /** * Objects implementing this protocol can be copied. */ Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -426,6 +426,73 @@ if (PRE_IVAR->memchunks != NULL) free(PRE_IVAR->memchunks); free((char*)self - PRE_IVAR_ALIGN); } + +/* + * Those are needed as the root class is the superclass of the root class's + * metaclass and thus instance methods can be sent to class objects as well. + */ ++ addMemoryToPool: (void*)ptr +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ (void*)allocMemoryWithSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ (void*)allocMemoryForNItems: (size_t)nitems + withSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ (void*)resizeMemory: (void*)ptr + toSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ (void*)resizeMemory: (void*)ptr + toNItems: (size_t)nitems + withSize: (size_t)size +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ freeMemory: (void*)ptr +{ + @throw [OFNotImplementedException newWithClass: self + andSelector: _cmd]; +} + ++ retain +{ + return self; +} + ++ autorelease +{ + return self; +} + ++ (size_t)retainCount +{ + return SIZE_MAX; +} + ++ (void)release +{ +} + ++ (void)dealloc +{ +} @end