diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-03 18:33:47 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-03 18:33:47 +0100 |
commit | b47bc1b65a3db942bb7e7b2e9b62ddc92d98ca8f (patch) | |
tree | f287eb9dde13cbe24360f0be7b83716d6287738c /Objective-C | |
parent | 7736eab7d8a7b415dba3676a495c0ac3b2e28020 (diff) |
Avoid calling objcl_class_name on unregistered classes.
darcs-hash:ea38f791e7f2bdc840e92709e1b915d985cc9700
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/libobjcl.h | 1 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index c9b7345..ee5e03f 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -199,6 +199,7 @@ objcl_create_class (const char *class_name, void objcl_add_method (Class class, + const char *class_name, SEL method_name, IMP callback, int argc, diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index 5ef51c2..c4dc718 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -864,6 +864,7 @@ objcl_create_class (const char *class_name, void objcl_add_method (Class class, + const char *class_name, SEL method_name, IMP callback, int argc, @@ -884,15 +885,14 @@ objcl_add_method (Class class, else preclass_addMethod (class, method_name, imp, signature); #else - NSString *class_name; struct ObjCLMethod **methods; int index; - class_name = [NSString stringWithUTF8String: objcl_class_name (class)]; + NSString *class_name_id = [NSString stringWithUTF8String: class_name]; - TRACE (@"add-method: Find class."); - index = [[method_list_lengths objectForKey: class_name] intValue]; - methods = [[method_lists objectForKey: class_name] pointerValue]; + TRACE (@"add-method: Finding class."); + index = [[method_list_lengths objectForKey: class_name_id] intValue]; + methods = [[method_lists objectForKey: class_name_id] pointerValue]; TRACE (@"add-method: malloc"); methods = realloc (methods, (index + 1) * sizeof (struct ObjCLMethod *)); @@ -907,9 +907,9 @@ objcl_add_method (Class class, TRACE (@"add-method: Adding method to dictionary."); [method_lists setObject: [NSValue valueWithPointer: methods] - forKey: class_name]; + forKey: class_name_id]; [method_list_lengths setObject: [NSNumber numberWithInt: (index + 1)] - forKey: class_name]; + forKey: class_name_id]; #endif TRACE (@"Method added."); |