summaryrefslogtreecommitdiff
path: root/libobjc/init.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-12-21 22:49:37 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-12-21 22:49:37 +0000
commit1575c9deaec2277485cfa6f870826c9bcfe9172d (patch)
tree7b230e110e8855f7e0345ca7c88cdfb6276368f2 /libobjc/init.c
parent2fdd3e04687fa391b6f7b0941f4152e6a760622a (diff)
In libobjc/: 2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/: 2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com> PR libobjc/18764 * class.c (__objc_add_class_to_hash): Return YES if the class was added, and NO if it already existed. * init.c (__objc_init_class): If __objc_add_class_to_hash returns NO, then abort the program with an error message. * objc-private/runtime.h (__objc_add_class_to_hash): Updated declaration. From-SVN: r168139
Diffstat (limited to 'libobjc/init.c')
-rw-r--r--libobjc/init.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/libobjc/init.c b/libobjc/init.c
index 8e60bed97c4..0401fa432e9 100644
--- a/libobjc/init.c
+++ b/libobjc/init.c
@@ -879,22 +879,26 @@ void
__objc_init_class (Class class)
{
/* Store the class in the class table and assign class numbers. */
- __objc_add_class_to_hash (class);
-
- /* Register all of the selectors in the class and meta class. */
- __objc_register_selectors_from_class (class);
- __objc_register_selectors_from_class ((Class) class->class_pointer);
-
- /* Install the fake dispatch tables. */
- __objc_install_premature_dtable (class);
- __objc_install_premature_dtable (class->class_pointer);
-
- /* Register the instance methods as class methods, this is only done
- for root classes. */
- __objc_register_instance_methods_to_class (class);
-
- if (class->protocols)
- __objc_init_protocols (class->protocols);
+ if (__objc_add_class_to_hash (class))
+ {
+ /* Register all of the selectors in the class and meta class. */
+ __objc_register_selectors_from_class (class);
+ __objc_register_selectors_from_class ((Class) class->class_pointer);
+
+ /* Install the fake dispatch tables. */
+ __objc_install_premature_dtable (class);
+ __objc_install_premature_dtable (class->class_pointer);
+
+ /* Register the instance methods as class methods, this is only
+ done for root classes. */
+ __objc_register_instance_methods_to_class (class);
+
+ if (class->protocols)
+ __objc_init_protocols (class->protocols);
+ }
+ else
+ _objc_abort ("Module contains duplicate class '%s'\n",
+ class->name);
}
/* __objc_init_protocol must be called with __objc_runtime_mutex