Differences From Artifact [e350530160]:
- File src/OFObject.m — part of check-in [db5f8c2c1b] at 2011-07-31 02:07:17 on branch trunk — Implement adding methods for the GNU runtime. (user: js, size: 26202) [annotate] [blame] [check-ins using]
To Artifact [c563fc5512]:
- File
src/OFObject.m
— part of check-in
[fbee44d38e]
at
2011-07-31 19:45:37
on branch trunk
— Cleaner -[setImplementation:...] for old GNU runtime.
Still work needed to correctly update the dtable. (user: js, size: 26486) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
336 337 338 339 340 341 342 | if (newImp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_class_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; | | < | | > > | > | > > | > > | | | > | > > > | > | > | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | if (newImp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_class_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_class_method(self->class_pointer, selector); if (newImp == (IMP)0 || method == METHOD_NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; for (iter = ((Class)self->class_pointer)->methods; iter != NULL; iter = iter->method_next) { int i; for (i = 0; i < iter->method_count; i++) if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; sarray_at_put_safe( ((Class)self->class_pointer)->dtable, (sidx)selector->sel_id, newImp); return oldImp; } } assert([self addClassMethod: selector withTypeEncoding: method->method_types implementation: newImp]); return (IMP)0; #else Method method; if (newImp == (IMP)0 || (method = class_getClassMethod(self, selector)) == NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; |
︙ | ︙ | |||
399 400 401 402 403 404 405 | #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_instance_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) | > > > | < | > | > | > > | > > | < < < | | | > > > > > > > > | 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 457 | #if defined(OF_OBJFW_RUNTIME) if (newImp == (IMP)0 || !class_respondsToSelector(self, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_instance_method(self, selector, newImp); #elif defined(OF_OLD_GNU_RUNTIME) Method_t method; MethodList_t iter; method = class_get_instance_method(self, selector); if (newImp == (IMP)0 || method == METHOD_NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; for (iter = ((Class)self)->methods; iter != NULL; iter = iter->method_next) { int i; for (i = 0; i < iter->method_count; i++) if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; sarray_at_put_safe(((Class)self)->dtable, (sidx)selector->sel_id, newImp); return oldImp; } } assert([self addInstanceMethod: selector withTypeEncoding: method->method_types implementation: newImp]); return (IMP)0; #else Method method; if (newImp == (IMP)0 || (method = class_getInstanceMethod(self, selector)) == NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; |
︙ | ︙ |