aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>2001-06-20 13:51:19 +0000
committerStan Shebs <shebs@gcc.gnu.org>2001-06-20 13:51:19 +0000
commitf5e6aae050dbc15f297785d284bd33eb778509a5 (patch)
treec93d49af5ccb64d9f895232329b7f25a53eb5038 /gcc/objc
parent5f2d6cfa81853503bd97f87c35fba49bac9ba699 (diff)
downloadgcc-f5e6aae050dbc15f297785d284bd33eb778509a5.zip
gcc-f5e6aae050dbc15f297785d284bd33eb778509a5.tar.gz
gcc-f5e6aae050dbc15f297785d284bd33eb778509a5.tar.bz2
objc-act.c (hash_init): Assume xmalloc always succeeds, also use memset to clear the hash tables.
* objc/objc-act.c (hash_init): Assume xmalloc always succeeds, also use memset to clear the hash tables. (hash_enter): Assume xmalloc always succeeds. (hash_add_attr): Ditto. (continue_class): Ditto. From-SVN: r43472
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/objc-act.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 1ef1199..076637e 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -5447,21 +5447,11 @@ build_ivar_reference (id)
static void
hash_init ()
{
- nst_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
- cls_method_hash_list = (hash *)xmalloc (SIZEHASHTABLE * sizeof (hash));
+ nst_method_hash_list = (hash *) xmalloc (SIZEHASHTABLE * sizeof (hash));
+ cls_method_hash_list = (hash *) xmalloc (SIZEHASHTABLE * sizeof (hash));
- if (!nst_method_hash_list || !cls_method_hash_list)
- perror ("unable to allocate space in objc-act.c");
- else
- {
- int i;
-
- for (i = 0; i < SIZEHASHTABLE; i++)
- {
- nst_method_hash_list[i] = 0;
- cls_method_hash_list[i] = 0;
- }
- }
+ memset (nst_method_hash_list, 0, SIZEHASHTABLE * sizeof (hash));
+ memset (cls_method_hash_list, 0, SIZEHASHTABLE * sizeof (hash));
}
/* WARNING!!!! hash_enter is called with a method, and will peek
@@ -5484,8 +5474,6 @@ hash_enter (hashlist, method)
hash_alloc_index = 0;
hash_alloc_list = (hash) xmalloc (sizeof (struct hashed_entry)
* HASH_ALLOC_LIST_SIZE);
- if (! hash_alloc_list)
- perror ("unable to allocate in objc-act.c");
}
obj = &hash_alloc_list[hash_alloc_index++];
obj->list = 0;
@@ -5528,8 +5516,6 @@ hash_add_attr (entry, value)
attr_alloc_index = 0;
attr_alloc_list = (attr) xmalloc (sizeof (struct hashed_attribute)
* ATTR_ALLOC_LIST_SIZE);
- if (! attr_alloc_list)
- perror ("unable to allocate in objc-act.c");
}
obj = &attr_alloc_list[attr_alloc_index++];
obj->next = entry->list;
@@ -6309,9 +6295,7 @@ continue_class (class)
if (!objc_class_template)
build_class_template ();
- if (!(imp_entry
- = (struct imp_entry *) xmalloc (sizeof (struct imp_entry))))
- perror ("unable to allocate in objc-act.c");
+ imp_entry = (struct imp_entry *) xmalloc (sizeof (struct imp_entry));
imp_entry->next = imp_list;
imp_entry->imp_context = class;