@@ -85,15 +85,15 @@ id owner; }; #define PRE_IVARS_ALIGN ((sizeof(struct pre_ivar) + \ (OF_BIGGEST_ALIGNMENT - 1)) & ~(OF_BIGGEST_ALIGNMENT - 1)) -#define PRE_IVARS ((struct pre_ivar*)(void*)((char*)self - PRE_IVARS_ALIGN)) +#define PRE_IVARS ((struct pre_ivar *)(void *)((char *)self - PRE_IVARS_ALIGN)) #define PRE_MEM_ALIGN ((sizeof(struct pre_mem) + \ (OF_BIGGEST_ALIGNMENT - 1)) & ~(OF_BIGGEST_ALIGNMENT - 1)) -#define PRE_MEM(mem) ((struct pre_mem*)(void*)((char*)mem - PRE_MEM_ALIGN)) +#define PRE_MEM(mem) ((struct pre_mem *)(void *)((char *)mem - PRE_MEM_ALIGN)) static struct { Class isa; } allocFailedException; @@ -166,40 +166,40 @@ if OF_UNLIKELY (instance == nil) { allocFailedException.isa = [OFAllocFailedException class]; @throw (id)&allocFailedException; } - ((struct pre_ivar*)instance)->retainCount = 1; - ((struct pre_ivar*)instance)->firstMem = NULL; - ((struct pre_ivar*)instance)->lastMem = NULL; + ((struct pre_ivar *)instance)->retainCount = 1; + ((struct pre_ivar *)instance)->firstMem = NULL; + ((struct pre_ivar *)instance)->lastMem = NULL; #if !defined(OF_HAVE_ATOMIC_OPS) && defined(OF_HAVE_THREADS) if OF_UNLIKELY (!of_spinlock_new( - &((struct pre_ivar*)instance)->retainCountSpinlock)) { + &((struct pre_ivar *)instance)->retainCountSpinlock)) { free(instance); @throw [OFInitializationFailedException exceptionWithClass: class]; } #endif - instance = (OFObject*)((char*)instance + PRE_IVARS_ALIGN); + instance = (OFObject *)(void *)((char *)instance + PRE_IVARS_ALIGN); memset(instance, 0, instanceSize); if (!objc_constructInstance(class, instance)) { - free((char*)instance - PRE_IVARS_ALIGN); + free((char *)instance - PRE_IVARS_ALIGN); @throw [OFInitializationFailedException exceptionWithClass: class]; } if OF_UNLIKELY (extra != NULL) - *extra = (char*)instance + instanceSize + extraAlignment; + *extra = (char *)instance + instanceSize + extraAlignment; return instance; } -const char* +const char * _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: [OFLocalization encoding]]; } @@ -228,12 +228,12 @@ * * Unfortunately, there is no way to check if a forward handler has * already been set, so this is the best we can do. */ if (&NSFoundationVersionNumber == NULL) - objc_setForwardHandler((void*)&of_forward, - (void*)&of_forward_stret); + objc_setForwardHandler((void *)&of_forward, + (void *)&of_forward_stret); #else objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret); #endif objc_setEnumerationMutationHandler(enumerationMutationHandler); @@ -278,11 +278,11 @@ + (Class)class { return self; } -+ (OFString*)className ++ (OFString *)className { return [OFString stringWithCString: class_getName(self) encoding: OF_STRING_ENCODING_ASCII]; } @@ -303,11 +303,11 @@ + (bool)instancesRespondToSelector: (SEL)selector { return class_respondsToSelector(self, selector); } -+ (bool)conformsToProtocol: (Protocol*)protocol ++ (bool)conformsToProtocol: (Protocol *)protocol { Class c; for (c = self; c != Nil; c = class_getSuperclass(c)) if (class_conformsToProtocol(c, protocol)) @@ -319,11 +319,11 @@ + (IMP)instanceMethodForSelector: (SEL)selector { return class_getMethodImplementation(self, selector); } -+ (const char*)typeEncodingForInstanceSelector: (SEL)selector ++ (const char *)typeEncodingForInstanceSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) return class_getMethodTypeEncoding(self, selector); #else Method m; @@ -333,11 +333,11 @@ return method_getTypeEncoding(m); #endif } -+ (OFString*)description ++ (OFString *)description { return [self className]; } + (IMP)replaceClassMethod: (SEL)selector @@ -368,19 +368,19 @@ typeEncoding: typeEncoding]; } + (IMP)replaceInstanceMethod: (SEL)selector withImplementation: (IMP)implementation - typeEncoding: (const char*)typeEncoding + typeEncoding: (const char *)typeEncoding { return class_replaceMethod(self, selector, implementation, typeEncoding); } + (IMP)replaceClassMethod: (SEL)selector withImplementation: (IMP)implementation - typeEncoding: (const char*)typeEncoding + typeEncoding: (const char *)typeEncoding { return class_replaceMethod(object_getClass(self), selector, implementation, typeEncoding); } @@ -499,11 +499,11 @@ - (Class)superclass { return class_getSuperclass(object_getClass(self)); } -- (OFString*)className +- (OFString *)className { return [OFString stringWithCString: object_getClassName(self) encoding: OF_STRING_ENCODING_ASCII]; } @@ -525,11 +525,11 @@ - (bool)respondsToSelector: (SEL)selector { return class_respondsToSelector(object_getClass(self), selector); } -- (bool)conformsToProtocol: (Protocol*)protocol +- (bool)conformsToProtocol: (Protocol *)protocol { return [object_getClass(self) conformsToProtocol: protocol]; } - (IMP)methodForSelector: (SEL)selector @@ -538,13 +538,13 @@ } - (id)performSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) - id (*imp)(id, SEL) = (id(*)(id, SEL))objc_msg_lookup(self, selector); + id (*imp)(id, SEL) = (id (*)(id, SEL))objc_msg_lookup(self, selector); #elif defined(OF_APPLE_RUNTIME) - id (*imp)(id, SEL) = (id(*)(id, SEL))objc_msgSend; + id (*imp)(id, SEL) = (id (*)(id, SEL))objc_msgSend; #endif return imp(self, selector); } @@ -551,13 +551,13 @@ - (id)performSelector: (SEL)selector withObject: (id)object { #if defined(OF_OBJFW_RUNTIME) id (*imp)(id, SEL, id) = - (id(*)(id, SEL, id))objc_msg_lookup(self, selector); + (id (*)(id, SEL, id))objc_msg_lookup(self, selector); #elif defined(OF_APPLE_RUNTIME) - id (*imp)(id, SEL, id) = (id(*)(id, SEL, id))objc_msgSend; + id (*imp)(id, SEL, id) = (id (*)(id, SEL, id))objc_msgSend; #endif return imp(self, selector, object); } @@ -565,13 +565,13 @@ withObject: (id)object1 withObject: (id)object2 { #if defined(OF_OBJFW_RUNTIME) id (*imp)(id, SEL, id, id) = - (id(*)(id, SEL, id, id))objc_msg_lookup(self, selector); + (id (*)(id, SEL, id, id))objc_msg_lookup(self, selector); #elif defined(OF_APPLE_RUNTIME) - id (*imp)(id, SEL, id, id) = (id(*)(id, SEL, id, id))objc_msgSend; + id (*imp)(id, SEL, id, id) = (id (*)(id, SEL, id, id))objc_msgSend; #endif return imp(self, selector, object1, object2); } @@ -620,11 +620,11 @@ objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_THREADS - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 target: self @@ -637,11 +637,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread withObject: (id)object waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); OFTimer *timer = [OFTimer timerWithTimeInterval: 0 @@ -656,11 +656,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread withObject: (id)object1 withObject: (id)object2 waitUntilDone: (bool)waitUntilDone { void *pool = objc_autoreleasePoolPush(); @@ -731,11 +731,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); [[thread runLoop] addTimer: [OFTimer timerWithTimeInterval: delay @@ -745,11 +745,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread withObject: (id)object afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); @@ -761,11 +761,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector - onThread: (OFThread*)thread + onThread: (OFThread *)thread withObject: (id)object1 withObject: (id)object2 afterDelay: (of_time_interval_t)delay { void *pool = objc_autoreleasePoolPush(); @@ -779,11 +779,11 @@ objc_autoreleasePoolPop(pool); } #endif -- (const char*)typeEncodingForSelector: (SEL)selector +- (const char *)typeEncodingForSelector: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) return class_getMethodTypeEncoding(object_getClass(self), selector); #else Method m; @@ -816,18 +816,18 @@ OF_HASH_FINALIZE(hash); return hash; } -- (OFString*)description +- (OFString *)description { /* Classes containing data should reimplement this! */ return [OFString stringWithFormat: @"<%@>", [self className]]; } -- (void*)allocMemoryWithSize: (size_t)size +- (void *)allocMemoryWithSize: (size_t)size { void *pointer; struct pre_mem *preMem; if OF_UNLIKELY (size == 0) @@ -850,24 +850,24 @@ if OF_UNLIKELY (PRE_IVARS->firstMem == NULL) PRE_IVARS->firstMem = preMem; PRE_IVARS->lastMem = preMem; - return (char*)pointer + PRE_MEM_ALIGN; + return (char *)pointer + PRE_MEM_ALIGN; } -- (void*)allocMemoryWithSize: (size_t)size - count: (size_t)count +- (void *)allocMemoryWithSize: (size_t)size + count: (size_t)count { if OF_UNLIKELY (count > SIZE_MAX / size) @throw [OFOutOfRangeException exception]; return [self allocMemoryWithSize: size * count]; } -- (void*)resizeMemory: (void*)pointer - size: (size_t)size +- (void *)resizeMemory: (void *)pointer + size: (size_t)size { void *new; struct pre_mem *preMem; if OF_UNLIKELY (pointer == NULL) @@ -899,16 +899,16 @@ PRE_IVARS->firstMem = preMem; if OF_UNLIKELY (PRE_IVARS->lastMem == PRE_MEM(pointer)) PRE_IVARS->lastMem = preMem; } - return (char*)new + PRE_MEM_ALIGN; + return (char *)new + PRE_MEM_ALIGN; } -- (void*)resizeMemory: (void*)pointer - size: (size_t)size - count: (size_t)count +- (void *)resizeMemory: (void *)pointer + size: (size_t)size + count: (size_t)count { if OF_UNLIKELY (pointer == NULL) return [self allocMemoryWithSize: size count: count]; @@ -922,11 +922,11 @@ return [self resizeMemory: pointer size: size * count]; } -- (void)freeMemory: (void*)pointer +- (void)freeMemory: (void *)pointer { if OF_UNLIKELY (pointer == NULL) return; if OF_UNLIKELY (PRE_MEM(pointer)->owner != self) @@ -1048,25 +1048,25 @@ free(iter); iter = next; } - free((char*)self - PRE_IVARS_ALIGN); + free((char *)self - PRE_IVARS_ALIGN); } /* Required to use properties with the Apple runtime */ -- copyWithZone: (void*)zone +- copyWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } return [(id)self copy]; } -- mutableCopyWithZone: (void*)zone +- mutableCopyWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } @@ -1076,35 +1076,35 @@ /* * 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. */ -+ (void*)allocMemoryWithSize: (size_t)size ++ (void *)allocMemoryWithSize: (size_t)size { OF_UNRECOGNIZED_SELECTOR } -+ (void*)allocMemoryWithSize: (size_t)size ++ (void *)allocMemoryWithSize: (size_t)size count: (size_t)count { OF_UNRECOGNIZED_SELECTOR } -+ (void*)resizeMemory: (void*)pointer - size: (size_t)size ++ (void *)resizeMemory: (void *)pointer + size: (size_t)size { OF_UNRECOGNIZED_SELECTOR } -+ (void*)resizeMemory: (void*)pointer - size: (size_t)size - count: (size_t)count ++ (void *)resizeMemory: (void *)pointer + size: (size_t)size + count: (size_t)count { OF_UNRECOGNIZED_SELECTOR } -+ (void)freeMemory: (void*)pointer ++ (void)freeMemory: (void *)pointer { OF_UNRECOGNIZED_SELECTOR } + retain @@ -1134,21 +1134,21 @@ + copy { return self; } -+ mutableCopyWithZone: (void*)zone ++ mutableCopyWithZone: (void *)zone { OF_UNRECOGNIZED_SELECTOR } /* Required to use ObjFW from Swift */ -+ allocWithZone: (void*)zone ++ allocWithZone: (void *)zone { if OF_UNLIKELY (zone != NULL) { [self doesNotRecognizeSelector: _cmd]; abort(); } return [self alloc]; } @end