466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
Class
objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes)
{
struct objc_class *class, *metaclass;
Class iter, rootclass = Nil;
if (extraBytes > LONG_MAX)
OBJC_ERROR("extra_bytes out of range!")
if ((class = calloc(1, sizeof(*class))) == NULL ||
(metaclass = calloc(1, sizeof(*class))) == NULL)
OBJC_ERROR("Not enough memory to allocate class pair for class "
"%s!", name)
class->isa = metaclass;
|
|
|
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
Class
objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes)
{
struct objc_class *class, *metaclass;
Class iter, rootclass = Nil;
if (extraBytes > LONG_MAX)
OBJC_ERROR("extraBytes out of range!")
if ((class = calloc(1, sizeof(*class))) == NULL ||
(metaclass = calloc(1, sizeof(*class))) == NULL)
OBJC_ERROR("Not enough memory to allocate class pair for class "
"%s!", name)
class->isa = metaclass;
|
842
843
844
845
846
847
848
849
850
851
852
853
854
855
|
object_getClass(id object_)
{
struct objc_object *object;
if (object_ == nil)
return Nil;
object = (struct objc_object *)object_;
return object->isa;
}
Class
object_setClass(id object_, Class class)
|
>
>
>
|
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
|
object_getClass(id object_)
{
struct objc_object *object;
if (object_ == nil)
return Nil;
if (object_isTaggedPointer(object_))
return object_getTaggedPointerClass(object_);
object = (struct objc_object *)object_;
return object->isa;
}
Class
object_setClass(id object_, Class class)
|