From 42d28de5b2f987923c3211d85f345ff951bd9b90 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Mon, 16 Jul 2001 13:36:24 +0200 Subject: [PATCH] Fixed object_is_class and object_is_metaclass From-SVN: r44039 --- libobjc/ChangeLog | 7 +++++++ libobjc/objc/objc-api.h | 16 +++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 6cde604ed48..da205a15df0 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,10 @@ +Mon Jul 16 12:15:00 2001 Nicola Pero + + * objc/objc-api.h (object_is_class): Fixed - buggy code was trying + to cast an id to a Class, which can not be done. Make the check + by using CLS_ISMETA on the class pointer instead. + (object_is_meta_class): Similar fix. + 2001-06-09 Alexandre Oliva , Stephen L Moshier * configure.in (AC_EXEEXT): Work around in case it expands to diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h index d3e22f2088d..d0e3bb7fefb 100644 --- a/libobjc/objc/objc-api.h +++ b/libobjc/objc/objc-api.h @@ -578,21 +578,23 @@ object_get_super_class } static inline BOOL -object_is_class(id object) +object_is_class (id object) { - return CLS_ISCLASS((Class)object); + return ((object != nil) && CLS_ISMETA (object->class_pointer)); } - + static inline BOOL -object_is_instance(id object) +object_is_instance (id object) { - return (object!=nil)&&CLS_ISCLASS(object->class_pointer); + return ((object != nil) && CLS_ISCLASS (object->class_pointer)); } static inline BOOL -object_is_meta_class(id object) +object_is_meta_class (id object) { - return CLS_ISMETA((Class)object); + return ((object != nil) + && !object_is_instance (object) + && !object_is_class (object)); } struct sarray* -- 2.30.2