From d5583faaa02a4b172d0baa935b4b669731a562df Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 16 Sep 2011 08:49:33 +0000 Subject: [PATCH] apple compatibility fix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@33845 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ sendmsg.c | 30 +++++------------------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a5495e..73ef2ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-16 Richard Frith-Macdonald + + * sendmsg.c: fix to send +initialize to class whether the class + implements it directly or inherits it (Apple compatibility). + 2011-04-30 Wolfgang Lux * init.c (__objc_tree_insert_class): Fix incorrect format diff --git a/sendmsg.c b/sendmsg.c index 0360dba..9906dfd 100644 --- a/sendmsg.c +++ b/sendmsg.c @@ -350,32 +350,12 @@ __objc_send_initialize (Class class) __objc_send_initialize (class->super_class); { - SEL op = sel_register_name ("initialize"); - IMP imp = 0; - MethodList_t method_list = class->class_pointer->methods; + SEL op = sel_register_name ("initialize"); + Method_t method; - while (method_list) { - int i; - Method_t method; - - for (i = 0; i < method_list->method_count; i++) { - method = &(method_list->method_list[i]); - if (method->method_name - && method->method_name->sel_id == op->sel_id) { - imp = method->method_imp; - break; - } - } - - if (imp) - break; - - method_list = method_list->method_next; - - } - if (imp) - (*imp) ((id) class, op); - + method = class_get_class_method(class->class_pointer, op); + if (method) + (*method->method_imp) ((id)class, op); } } }