@@ -278,13 +278,11 @@ encoding: OF_STRING_ENCODING_ASCII]; } + (bool)isSubclassOfClass: (Class)class { - Class iter; - - for (iter = self; iter != Nil; iter = class_getSuperclass(iter)) + for (Class iter = self; iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) return true; return false; } @@ -384,17 +382,14 @@ if ([self isSubclassOfClass: class]) return; #if defined(OF_OBJFW_RUNTIME) - struct objc_method_list *methodlist; - - for (methodlist = object_getClass(class)->methodlist; + for (struct objc_method_list *methodlist = + object_getClass(class)->methodlist; methodlist != NULL; methodlist = methodlist->next) { - int i; - - for (i = 0; i < methodlist->count; i++) { + for (int i = 0; i < methodlist->count; i++) { SEL selector = (SEL)&methodlist->methods[i].sel; /* * Don't replace methods implemented in the receiving * class. @@ -406,15 +401,13 @@ [self replaceClassMethod: selector withMethodFromClass: class]; } } - for (methodlist = class->methodlist; methodlist != NULL; - methodlist = methodlist->next) { - int i; - - for (i = 0; i < methodlist->count; i++) { + for (struct objc_method_list *methodlist = class->methodlist; + methodlist != NULL; methodlist = methodlist->next) { + for (int i = 0; i < methodlist->count; i++) { SEL selector = (SEL)&methodlist->methods[i].sel; /* * Don't replace methods implemented in the receiving * class. @@ -427,15 +420,15 @@ withMethodFromClass: class]; } } #elif defined(OF_APPLE_RUNTIME) Method *methodList; - unsigned i, count; + unsigned int count; methodList = class_copyMethodList(object_getClass(class), &count); @try { - for (i = 0; i < count; i++) { + for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methodList[i]); /* * Don't replace methods implemented in the receiving * class. @@ -451,11 +444,11 @@ free(methodList); } methodList = class_copyMethodList(class, &count); @try { - for (i = 0; i < count; i++) { + for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methodList[i]); /* * Don't replace methods implemented in the receiving * class. @@ -506,13 +499,11 @@ encoding: OF_STRING_ENCODING_ASCII]; } - (bool)isKindOfClass: (Class)class { - Class iter; - - for (iter = object_getClass(self); iter != Nil; + for (Class iter = object_getClass(self); iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) return true; return false;