Differences From Artifact [4b9ff362fe]:
- File
src/OFObject.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 24533) [annotate] [blame] [check-ins using]
To Artifact [6e92aa6c33]:
- File src/OFObject.m — part of check-in [e0b9167693] at 2016-02-21 15:37:42 on branch trunk — Make use of C99-style for loops (user: js, size: 24548) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
276 277 278 279 280 281 282 | { return [OFString stringWithCString: class_getName(self) encoding: OF_STRING_ENCODING_ASCII]; } + (bool)isSubclassOfClass: (Class)class { | < < | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | { return [OFString stringWithCString: class_getName(self) encoding: OF_STRING_ENCODING_ASCII]; } + (bool)isSubclassOfClass: (Class)class { for (Class iter = self; iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) return true; return false; } + (Class)superclass |
︙ | ︙ | |||
382 383 384 385 386 387 388 | { Class superclass = [self superclass]; if ([self isSubclassOfClass: class]) return; #if defined(OF_OBJFW_RUNTIME) | | < | < < | | | < < | | | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | { Class superclass = [self superclass]; if ([self isSubclassOfClass: class]) return; #if defined(OF_OBJFW_RUNTIME) for (struct objc_method_list *methodlist = object_getClass(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. */ if ([self methodForSelector: selector] != [superclass methodForSelector: selector]) continue; [self replaceClassMethod: selector withMethodFromClass: class]; } } 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. */ if ([self instanceMethodForSelector: selector] != [superclass instanceMethodForSelector: selector]) continue; [self replaceInstanceMethod: selector withMethodFromClass: class]; } } #elif defined(OF_APPLE_RUNTIME) Method *methodList; unsigned int count; methodList = class_copyMethodList(object_getClass(class), &count); @try { for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methodList[i]); /* * Don't replace methods implemented in the receiving * class. */ if ([self methodForSelector: selector] != [superclass methodForSelector: selector]) continue; [self replaceClassMethod: selector withMethodFromClass: class]; } } @finally { free(methodList); } methodList = class_copyMethodList(class, &count); @try { for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methodList[i]); /* * Don't replace methods implemented in the receiving * class. */ if ([self instanceMethodForSelector: selector] != |
︙ | ︙ | |||
504 505 506 507 508 509 510 | { return [OFString stringWithCString: object_getClassName(self) encoding: OF_STRING_ENCODING_ASCII]; } - (bool)isKindOfClass: (Class)class { | < < | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | { return [OFString stringWithCString: object_getClassName(self) encoding: OF_STRING_ENCODING_ASCII]; } - (bool)isKindOfClass: (Class)class { for (Class iter = object_getClass(self); iter != Nil; iter = class_getSuperclass(iter)) if (iter == class) return true; return false; } |
︙ | ︙ |