Class*
class_pose_as (Class* impostor, Class* super_class)
{
- Class* new_class = (Class*) calloc (1, sizeof (Class));
+ Class* new_class = (Class*) __objc_xcalloc (1, sizeof (Class));
MetaClass* new_meta_class =
(MetaClass*) __objc_xmalloc(sizeof (MetaClass));
char *new_name = (char *)__objc_xmalloc ((size_t)strlen ((char*)super_class->name) + 12);
/* Allocate the cache structure. calloc insures
its initialization for default values. */
- cache = (cache_ptr) calloc (1, sizeof (struct cache));
+ cache = (cache_ptr) __objc_xcalloc (1, sizeof (struct cache));
assert (cache);
/* Allocate the array of buckets for the cache.
calloc initializes all of the pointers to NULL. */
cache->node_table
- = (node_ptr *) calloc (size, sizeof (node_ptr));
+ = (node_ptr *) __objc_xcalloc (size, sizeof (node_ptr));
assert (cache->node_table);
cache->size = size;
hash_add (cache_ptr *cachep, const void *key, void *value)
{
size_t indx = (*(*cachep)->hash_func)(*cachep, key);
- node_ptr node = (node_ptr) calloc (1, sizeof (struct cache_node));
+ node_ptr node = (node_ptr) __objc_xcalloc (1, sizeof (struct cache_node));
assert (node);
if (CLS_ISCLASS(class))
new = (*_objc_object_alloc)(class);
if (new!=nil)
- new->class_pointer = class;
+ {
+ bzero (new, class->instance_size);
+ new->class_pointer = class;
+ }
return new;
}