/* Convert the flexible array to an array that can be handled
by standard C. */
- p = (entity **)xmalloc(sizeof(*p) * ARR_LEN(free_meths));
+ p = xmalloc(sizeof(*p) * ARR_LEN(free_meths));
memcpy(p, free_meths, ARR_LEN(free_meths) * sizeof(*p));
*length = ARR_LEN(free_meths);
irg_block_walk(get_irg_end(current_ir_graph), count_and_init_blocks, NULL, &n_blocks);
/* Memory for temporary information. */
- tdi_list = xmalloc(n_blocks * sizeof(tmp_dom_info));
- memset(tdi_list, 0, n_blocks * sizeof(tmp_dom_info));
+ tdi_list = xmalloc(n_blocks * sizeof(*tdi_list));
+ memset(tdi_list, 0, n_blocks * sizeof(*tdi_list));
/* We need the out datastructure. */
if (current_ir_graph->outs_state != outs_consistent)
n_out_edges = count_outs(get_irg_end(irg));
/* allocate memory for all out edges. */
- irg->outs = (ir_node **) xmalloc (n_out_edges * sizeof(ir_node *));
+ irg->outs = xmalloc (n_out_edges * sizeof(*irg->outs));
#ifdef DEBUG_libfirm
irg->n_outs = n_out_edges;
#endif /* defined DEBUG_libfirm */
}
global_count = n_out_edges = count_ip_outs();
- out_edges = (ir_node **) xmalloc (n_out_edges * sizeof(ir_node *));
+ out_edges = xmalloc(n_out_edges * sizeof(*out_edges));
set_irp_ip_outedges(out_edges);
set_ip_outs();
}
==================== */
static void append_alloc (graph_info_t *ginfo, ir_node *alloc, type *tp)
{
- alloc_info_t *ainfo = (alloc_info_t*) xmalloc (sizeof (alloc_info_t));
+ alloc_info_t *ainfo = xmalloc(sizeof(*ainfo));
ainfo->graph = ginfo->graph;
ainfo->alloc = alloc;
*/
static callEd_info_t *append_callEd_info (callEd_info_t *ced, ir_graph *callEd)
{
- callEd_info_t *nced = (callEd_info_t*) xmalloc (sizeof (sizeof (callEd_info_t)));
+ callEd_info_t *nced = xmalloc(sizeof(*nced));
nced->callEd = callEd;
nced->prev = ced;
*/
static void append_calls (graph_info_t *info, ir_node *call, lset_t *callEds)
{
- call_info_t *cinfo = xmalloc (sizeof(*cinfo));
+ call_info_t *cinfo = xmalloc(sizeof(*cinfo));
ir_graph *callEd;
/* setup */
*/
static void ecg_fill_graph_calls (ir_graph *graph)
{
- graph_info_t *ginfo = (graph_info_t*) xmalloc (sizeof (graph_info_t));
+ graph_info_t *ginfo = xmalloc(sizeof(*ginfo));
/* memset (ginfo, 0x00, sizeof (graph_info_t)); */
assert (ginfo != graph_infos_list);
*/
static ctx_info_t *new_ctx (ir_graph *graph, ir_node *call, ctx_info_t *enc)
{
- ctx_info_t *res = xmalloc (sizeof (ctx_info_t));
+ ctx_info_t *res = xmalloc(sizeof(*res));
res->graph = graph;
res->call = call;
graph_info_t *ginfo = graph_infos_list;
while (NULL != ginfo) {
- ginfo->ctxs = (ctx_info_t **) xmalloc (ginfo->n_ctxs * sizeof (ctx_info_t*));
+ ginfo->ctxs = xmalloc(ginfo->n_ctxs * sizeof(*ginfo->ctxs));
/*
fprintf (stdout, "graph of \"%s\": n_ctxs = %i\n",
/* Grrr, have to add this ctx manually to main.ginfo ... */
ginfo = ecg_get_info (main_irg);
ginfo->n_ctxs = 1;
- ginfo->ctxs = xmalloc (1 * sizeof (ctx_info_t*));
+ ginfo->ctxs = xmalloc(1 * sizeof(*ginfo->ctxs));
ginfo->ctxs [0] = main_ctx;
ecg_fill_ctxs_write (main_irg, main_ctx);
/*
$Log$
+ Revision 1.14 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.13 2004/12/21 14:21:16 beck
removed C99 constructs
void *env)
{
ir_node *end_block = get_irg_end_block (graph);
- walk_mem_env_t *walk_env = (walk_mem_env_t*) xmalloc (sizeof (walk_mem_env_t));
+ walk_mem_env_t *walk_env = xmalloc(sizeof(*walk_env));
assert (! get_irg_is_mem_visited (graph));
/*
$Log$
+ Revision 1.8 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.7 2004/12/21 14:25:35 beck
removed C99 constructs
make visit counter of same type as irn visit counter
/* create a new lset */
lset_t *lset_create (void)
{
- lset_t *lset = xmalloc (sizeof (lset_t));
+ lset_t *lset = xmalloc(sizeof(*lset));
return (lset);
}
void lset_insert (lset_t *lset, void *data)
{
if (! lset_contains (lset, data)) {
- lset_entry_t *entry = xmalloc (sizeof (lset_entry_t));
+ lset_entry_t *entry = xmalloc(sizeof(*entry));
entry->data = data;
entry->next = lset->first;
lset->first = entry;
\f
/*
$Log$
+ Revision 1.3 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.2 2004/12/02 16:17:51 beck
fixed config.h include
ecg_iterate_graphs (pto_init_graph_wrapper, NULL);
/* debugging only */
- spaces = (char*) xmalloc (512 * sizeof (char));
+ spaces = xmalloc (512 * sizeof(spaces[0]));
memset (spaces, ' ', 512);
spaces += 511;
*spaces = '\0';
\f
/*
$Log$
+ Revision 1.16 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.15 2004/12/21 14:26:53 beck
removed C99 constructs
assert (NULL == name_obst);
assert (NULL == qset_obst);
- name_obst = xmalloc (sizeof (struct obstack));
- qset_obst = xmalloc (sizeof (struct obstack));
+ name_obst = xmalloc (sizeof(*name_obst));
+ qset_obst = xmalloc (sizeof(*qset_obst));
obstack_init (name_obst);
obstack_init (qset_obst);
\f
/*
$Log$
+ Revision 1.10 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.9 2004/12/21 15:34:09 beck
removed C99 constructs
make const float
{
type *tp = get_entity_type (get_irg_entity (graph));
const int n_args = get_method_n_params (tp);
- ir_node **args = (ir_node**) xmalloc (sizeof (ir_node*) * (n_args+1));
+ ir_node **args = xmalloc (sizeof(*args) * (n_args+1));
ir_node *arg = get_irg_args (graph);
- find_irg_args_env_t *arg_env =
- (find_irg_args_env_t*) xmalloc (sizeof (find_irg_args_env_t));
+ find_irg_args_env_t *arg_env = xmalloc(sizeof(*arg_env));
arg_env->args = args;
arg_env->arg = arg;
\f
/*
$Log$
+ Revision 1.13 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.12 2004/12/21 15:53:12 beck
removed GNUC constructs
*/
static typalise_t *ta_exact (type *tp)
{
- typalise_t *ta = (typalise_t*) xmalloc (sizeof (typalise_t));
+ typalise_t *ta = xmalloc (sizeof(*ta));
ta->kind = type_exact;
ta->res.type = tp;
ta->id = ta_id ++;
static typalise_t *ta_types (lset_t *set)
{
- typalise_t *ta = (typalise_t*) xmalloc (sizeof (typalise_t));
+ typalise_t *ta = xmalloc (sizeof(*ta));
ta->kind = type_types;
ta->res.types = set;
ta->id = ta_id ++;
static typalise_t *ta_type (type *tp)
{
- typalise_t *ta = (typalise_t*) xmalloc (sizeof (typalise_t));
+ typalise_t *ta = xmalloc (sizeof(*ta));
ta->kind = type_type;
ta->res.type = tp;
ta->id = ta_id ++;
\f
/*
$Log$
+ Revision 1.5 2004/12/22 14:43:14 beck
+ made allocations C-like
+
Revision 1.4 2004/12/21 15:50:18 beck
removed C99 constructs
assert(!id_contains_char(name, ' ') && "entity name should not contain spaces");
- res = (entity *) xmalloc (sizeof (entity));
- memset(res, 0, sizeof(res));
+ res = xmalloc(sizeof(*res));
+ memset(res, 0, sizeof(*res));
res->kind = k_entity;
res->owner = owner;
res->name = name;
entity *
copy_entity_own (entity *old, type *new_owner) {
- entity *new;
+ entity *newe;
assert(old && old->kind == k_entity);
assert_legal_owner_of_ent(new_owner);
if (old->owner == new_owner) return old;
- new = (entity *) xmalloc (sizeof (entity));
- memcpy (new, old, sizeof (entity));
- new->owner = new_owner;
+ newe = xmalloc(sizeof(*newe));
+ memcpy (newe, old, sizeof(*newe));
+ newe->owner = new_owner;
if (is_class_type(new_owner)) {
- new->overwrites = NEW_ARR_F(entity *, 0);
- new->overwrittenby = NEW_ARR_F(entity *, 0);
+ newe->overwrites = NEW_ARR_F(entity *, 0);
+ newe->overwrittenby = NEW_ARR_F(entity *, 0);
}
#ifdef DEBUG_libfirm
- new->nr = get_irp_new_node_nr();
+ newe->nr = get_irp_new_node_nr();
#endif
- insert_entity_in_owner (new);
+ insert_entity_in_owner (newe);
- return new;
+ return newe;
}
entity *
copy_entity_name (entity *old, ident *new_name) {
- entity *new;
+ entity *newe;
assert(old && old->kind == k_entity);
if (old->name == new_name) return old;
- new = (entity *) xmalloc (sizeof (entity));
- memcpy (new, old, sizeof (entity));
- new->name = new_name;
- new->ld_name = NULL;
- if (is_class_type(new->owner)) {
- new->overwrites = DUP_ARR_F(entity *, old->overwrites);
- new->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby);
+ newe = xmalloc(sizeof(*newe));
+ memcpy(newe, old, sizeof(*newe));
+ newe->name = new_name;
+ newe->ld_name = NULL;
+ if (is_class_type(newe->owner)) {
+ newe->overwrites = DUP_ARR_F(entity *, old->overwrites);
+ newe->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby);
}
#ifdef DEBUG_libfirm
- new->nr = get_irp_new_node_nr();
- new->c_name = (char *)get_id_str (new->name);
+ newe->nr = get_irp_new_node_nr();
+ newe->c_name = (char *)get_id_str (newe->name);
#endif
- insert_entity_in_owner (new);
+ insert_entity_in_owner (newe);
- return new;
+ return newe;
}
{
tp_op *res;
- res = (tp_op *) xmalloc (sizeof (tp_op));
+ res = xmalloc(sizeof(*res));
res->code = code;
res->name = name;
res->attr_size = attr_size;
assert(!id_contains_char(name, ' ') && "type name should not contain spaces");
node_size = offsetof(type, attr) + type_op->attr_size;
- res = (type *) xmalloc (node_size);
- memset((void *)res, 0, node_size);
+ res = xmalloc (node_size);
+ memset(res, 0, node_size);
add_irp_type(res); /* Remember the new type global. */
res->kind = k_type;
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 = (type **) xmalloc (sizeof (type *) * n_param);
+ res->attr.ma.param_type = xmalloc(sizeof(*res->attr.ma.param_type) * n_param);
res->attr.ma.value_params = NULL;
res->attr.ma.n_res = n_res;
- res->attr.ma.res_type = (type **) xmalloc (sizeof (type *) * n_res);
+ res->attr.ma.res_type = xmalloc(sizeof(*res->attr.ma.res_type) * n_res);
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 = (type **) xmalloc (sizeof (type *) * n_types);
- res->attr.ua.delim_names = (ident **) xmalloc (sizeof (ident *) * n_types); */
+ /*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.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 = (ir_node **) xmalloc (sizeof (ir_node *) * n_dimensions);
- res->attr.aa.upper_bound = (ir_node **) xmalloc (sizeof (ir_node *) * n_dimensions);
- res->attr.aa.order = (int *) xmalloc (sizeof (int) * 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);
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 = (tarval **)xmalloc(sizeof(res->attr.ea.enumer[0]) * n_enums);
- res->attr.ea.enum_nameid = (ident **)xmalloc(sizeof(res->attr.ea.enum_nameid[0]) * 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);
return res;