__set_type_link(tp, l);
}
-tp_op *(get_type_tpop)(const type *tp) {
+const tp_op *(get_type_tpop)(const type *tp) {
return __get_type_tpop(tp);
}
res->state = layout_fixed;
res->size = get_mode_size_bits(mode_P_mach);
res->attr.ma.n_params = n_param;
- res->attr.ma.param_type = xmalloc(sizeof(*res->attr.ma.param_type) * n_param);
+ res->attr.ma.param_type = xcalloc(n_param, sizeof(res->attr.ma.param_type[0]));
res->attr.ma.value_params = NULL;
res->attr.ma.n_res = n_res;
- res->attr.ma.res_type = xmalloc(sizeof(*res->attr.ma.res_type) * n_res);
+ res->attr.ma.res_type = xcalloc(n_res, sizeof(res->attr.ma.res_type[0]));
res->attr.ma.value_ress = NULL;
res->attr.ma.variadicity = variadicity_non_variadic;
res->attr.ma.first_variadic_param = -1;
type *new_type_union (ident *name) {
type *res;
res = new_type(type_union, NULL, name);
- /*res->attr.ua.unioned_type = xmalloc(sizeof(*res->attr.ua.unioned_type) * n_types);
- res->attr.ua.delim_names = xmalloc(sizeof(*res->attr.ua.delim_names) * n_types); */
+ /*res->attr.ua.unioned_type = xcalloc(n_types, sizeof(res->attr.ua.unioned_type[0]));
+ res->attr.ua.delim_names = xcalloc(n_types, sizeof(res->attr.ua.delim_names[0])); */
res->attr.ua.members = NEW_ARR_F (entity *, 0);
return res;
}
res = new_type(type_array, NULL, name);
res->attr.aa.n_dimensions = n_dimensions;
- res->attr.aa.lower_bound = xmalloc(sizeof(*res->attr.aa.lower_bound) * n_dimensions);
- res->attr.aa.upper_bound = xmalloc(sizeof(*res->attr.aa.upper_bound) * n_dimensions);
- res->attr.aa.order = xmalloc(sizeof(*res->attr.aa.order) * n_dimensions);
+ res->attr.aa.lower_bound = xcalloc(n_dimensions, sizeof(*res->attr.aa.lower_bound));
+ res->attr.aa.upper_bound = xcalloc(n_dimensions, sizeof(*res->attr.aa.upper_bound));
+ res->attr.aa.order = xcalloc(n_dimensions, sizeof(*res->attr.aa.order));
current_ir_graph = get_const_code_irg();
for (i = 0; i < n_dimensions; i++) {
type *res;
res = new_type(type_enumeration, NULL, name);
res->attr.ea.n_enums = n_enums;
- res->attr.ea.enumer = xmalloc(sizeof(res->attr.ea.enumer[0]) * n_enums);
- res->attr.ea.enum_nameid = xmalloc(sizeof(res->attr.ea.enum_nameid[0]) * n_enums);
- memset(res->attr.ea.enumer, 0, sizeof(res->attr.ea.enumer[0]) * n_enums);
- memset(res->attr.ea.enum_nameid, 0, sizeof(res->attr.ea.enum_nameid[0]) * n_enums);
+ res->attr.ea.enumer = xcalloc(n_enums, sizeof(res->attr.ea.enumer[0]));
+ res->attr.ea.enum_nameid = xcalloc(n_enums, sizeof(res->attr.ea.enum_nameid[0]));
return res;
}
type *new_d_type_enumeration (ident *name, int n_enums, dbg_info* db) {