aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-05-09 11:44:43 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-05-09 11:44:43 -0400
commita142e7ccfe7c084a8c1e2aeff1178a2d9659d383 (patch)
tree0f85d0d9412c12fe24b5c8c105652ab9c20965e8 /gcc
parentfa1b14518ae876a297be40bfa169e8f70df7aa2c (diff)
downloadgcc-a142e7ccfe7c084a8c1e2aeff1178a2d9659d383.zip
gcc-a142e7ccfe7c084a8c1e2aeff1178a2d9659d383.tar.gz
gcc-a142e7ccfe7c084a8c1e2aeff1178a2d9659d383.tar.bz2
(__objc_send_initialize): Call superclass if object does not implement
+initialize. From-SVN: r9597
Diffstat (limited to 'gcc')
-rw-r--r--gcc/objc/sendmsg.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/gcc/objc/sendmsg.c b/gcc/objc/sendmsg.c
index 9f252d8..9f52c8d 100644
--- a/gcc/objc/sendmsg.c
+++ b/gcc/objc/sendmsg.c
@@ -236,28 +236,34 @@ static void __objc_send_initialize(Class class)
__objc_send_initialize(class->super_class);
{
- MethodList_t method_list = class->class_pointer->methods;
- SEL op = sel_register_name ("initialize");
+ SEL op = sel_register_name ("initialize");
+ Class tmpclass = class;
+ IMP imp = 0;
- /* If not found then we'll search the list. */
- while (method_list)
- {
+ while (!imp && tmpclass) {
+ MethodList_t method_list = tmpclass->class_pointer->methods;
+
+ while(!imp && method_list) {
int i;
+ Method_t method;
- /* Search the method list. */
- for (i = 0; i < method_list->method_count; ++i)
- {
- Method_t method = &method_list->method_list[i];
-
-
- if (method->method_name->sel_id == op->sel_id)
- (*method->method_imp)((id) class, op);
+ for (i=0;i<method_list->method_count;i++) {
+ method = &(method_list->method_list[i]);
+ if (method->method_name->sel_id == op->sel_id) {
+ imp = method->method_imp;
+ break;
}
+ }
- /* The method wasn't found. Follow the link to the next list of
- methods. */
method_list = method_list->method_next;
+
}
+
+ tmpclass = tmpclass->super_class;
+ }
+ if (imp)
+ (*imp)((id)class, op);
+
}
}
}