aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKresten Krab Thorup <krab@gcc.gnu.org>1993-05-06 09:23:58 +0000
committerKresten Krab Thorup <krab@gcc.gnu.org>1993-05-06 09:23:58 +0000
commitd9d27c6e362dcc66164fdfedfaf4b9808d6ecd89 (patch)
tree3f52c813ef4f1f0c103ba3c2d258957b9f78e991 /gcc
parent8d46dca505984cdbc1e15685c5edc54885b2b76f (diff)
downloadgcc-d9d27c6e362dcc66164fdfedfaf4b9808d6ecd89.zip
gcc-d9d27c6e362dcc66164fdfedfaf4b9808d6ecd89.tar.gz
gcc-d9d27c6e362dcc66164fdfedfaf4b9808d6ecd89.tar.bz2
calloc -> __objc_xcalloc, bzero instances
From-SVN: r4351
Diffstat (limited to 'gcc')
-rw-r--r--gcc/objc/class.c2
-rw-r--r--gcc/objc/hash.c6
-rw-r--r--gcc/objc/objects.c5
3 files changed, 8 insertions, 5 deletions
diff --git a/gcc/objc/class.c b/gcc/objc/class.c
index 97e108e..c9af0eb 100644
--- a/gcc/objc/class.c
+++ b/gcc/objc/class.c
@@ -226,7 +226,7 @@ I implement posing by hiding SUPER_CLASS, creating new class and meta class
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);
diff --git a/gcc/objc/hash.c b/gcc/objc/hash.c
index 294d87b..2226a26 100644
--- a/gcc/objc/hash.c
+++ b/gcc/objc/hash.c
@@ -51,13 +51,13 @@ hash_new (unsigned int size, hash_func_type hash_func,
/* 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;
@@ -96,7 +96,7 @@ void
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);
diff --git a/gcc/objc/objects.c b/gcc/objc/objects.c
index 7574412..bd7a47e 100644
--- a/gcc/objc/objects.c
+++ b/gcc/objc/objects.c
@@ -41,7 +41,10 @@ class_create_instance(Class* class)
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;
}