if (objfile == NULL)
{
- type = xmalloc (sizeof (struct type));
- memset (type, 0, sizeof (struct type));
- TYPE_MAIN_TYPE (type) = xmalloc (sizeof (struct main_type));
+ type = XZALLOC (struct type);
+ TYPE_MAIN_TYPE (type) = XZALLOC (struct main_type);
}
else
{
- type = obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct type));
- memset (type, 0, sizeof (struct type));
- TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct main_type));
+ type = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct type);
+ TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (&objfile->objfile_obstack,
+ struct main_type);
OBJSTAT (objfile, n_types++);
}
- memset (TYPE_MAIN_TYPE (type), 0, sizeof (struct main_type));
/* Initialize the fields that might not be zero. */
/* Allocate the structure. */
if (TYPE_OBJFILE (oldtype) == NULL)
- {
- type = xmalloc (sizeof (struct type));
- memset (type, 0, sizeof (struct type));
- }
+ type = XZALLOC (struct type);
else
- {
- type = obstack_alloc (&TYPE_OBJFILE (oldtype)->objfile_obstack,
- sizeof (struct type));
- memset (type, 0, sizeof (struct type));
- }
+ type = OBSTACK_ZALLOC (&TYPE_OBJFILE (oldtype)->objfile_obstack,
+ struct type);
+
TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
TYPE_CHAIN (type) = type; /* Chain back to itself for now. */
int low_bound, int high_bound)
{
if (result_type == NULL)
- {
- result_type = alloc_type (TYPE_OBJFILE (index_type));
- }
+ result_type = alloc_type (TYPE_OBJFILE (index_type));
TYPE_CODE (result_type) = TYPE_CODE_RANGE;
TYPE_TARGET_TYPE (result_type) = index_type;
if (TYPE_STUB (index_type))
else
TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type));
TYPE_NFIELDS (result_type) = 2;
- TYPE_FIELDS (result_type) = TYPE_ALLOC (result_type,
- TYPE_NFIELDS (result_type)
- * sizeof (struct field));
- memset (TYPE_FIELDS (result_type), 0,
- TYPE_NFIELDS (result_type) * sizeof (struct field));
+ TYPE_FIELDS (result_type) = TYPE_ZALLOC (result_type,
+ TYPE_NFIELDS (result_type)
+ * sizeof (struct field));
TYPE_LOW_BOUND (result_type) = low_bound;
TYPE_HIGH_BOUND (result_type) = high_bound;
TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);
TYPE_NFIELDS (result_type) = 1;
TYPE_FIELDS (result_type) =
- (struct field *) TYPE_ALLOC (result_type, sizeof (struct field));
- memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
+ (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
TYPE_INDEX_TYPE (result_type) = range_type;
TYPE_VPTR_FIELDNO (result_type) = -1;
}
TYPE_CODE (result_type) = TYPE_CODE_SET;
TYPE_NFIELDS (result_type) = 1;
- TYPE_FIELDS (result_type) = (struct field *)
- TYPE_ALLOC (result_type, 1 * sizeof (struct field));
- memset (TYPE_FIELDS (result_type), 0, sizeof (struct field));
+ TYPE_FIELDS (result_type) = TYPE_ZALLOC (result_type, sizeof (struct field));
if (!TYPE_STUB (domain_type))
{
type = init_type (TYPE_CODE_FLAGS, length,
TYPE_FLAG_UNSIGNED, name, NULL);
TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = TYPE_ALLOC (type,
- nfields * sizeof (struct field));
- memset (TYPE_FIELDS (type), 0, nfields * sizeof (struct field));
+ TYPE_FIELDS (type) = TYPE_ZALLOC (type, nfields * sizeof (struct field));
return type;
}
int i, nfields;
nfields = TYPE_NFIELDS (type);
- TYPE_FIELDS (new_type) = xmalloc (sizeof (struct field) * nfields);
- memset (TYPE_FIELDS (new_type), 0, sizeof (struct field) * nfields);
+ TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field);
for (i = 0; i < nfields; i++)
{
TYPE_FIELD_ARTIFICIAL (new_type, i) =