make allocation C-like
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 22 Dec 2004 11:06:24 +0000 (11:06 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 22 Dec 2004 11:06:24 +0000 (11:06 +0000)
[r4718]

ir/st/st.c
ir/tr/entity.c

index e0edbc9..e1204c3 100644 (file)
@@ -119,9 +119,9 @@ static dt_t *new_dt (ir_graph *graph)
 
   res->n_blocks = n_blocks;
   res->graph    = graph;
-  res->blocks   = (ir_node**) calloc (n_blocks, sizeof (ir_node*));
-  res->idoms    = (ir_node**) calloc (n_blocks, sizeof (ir_node*));
-  res->masks    = (bs_t*)     calloc (n_blocks, sizeof (bs_t));
+  res->blocks   = calloc(n_blocks, sizeof(*res->blocks));
+  res->idoms    = calloc(n_blocks, sizeof(*res->idoms));
+  res->masks    = calloc(n_blocks, sizeof(*res->masks));
 
   assert (res && "no dt");
 
@@ -438,7 +438,7 @@ ir_node *get_idom (ir_graph *g, ir_node *a)
 */
 dom_env_t *get_dom_env (ir_graph *graph, ir_node *a)
 {
-  dom_env_t *env = (dom_env_t*) calloc (1, sizeof (dom_env_t));
+  dom_env_t *env = calloc(1, sizeof(*env));
 
   env->graph   = graph;
   env->dt      = get_dominator_tree (graph);
index 640fce6..aee090d 100644 (file)
@@ -582,11 +582,11 @@ new_compound_graph_path(type *tp, int length) {
   assert(is_type(tp) && is_compound_type(tp));
   assert(length > 0);
 
-  res = (compound_graph_path *) calloc (1, sizeof(compound_graph_path) + (length-1) * sizeof(entity *));
+  res = calloc (1, sizeof(*res) + (length-1) * sizeof(res->nodes[0]));
   res->kind          = k_ir_compound_graph_path;
   res->tp            = tp;
   res->len           = length;
-  res ->arr_indicees = (int *) calloc(length, sizeof(int));
+  res ->arr_indicees = calloc(length, sizeof(*res ->arr_indicees));
   return res;
 }
 
@@ -945,7 +945,7 @@ void compute_compound_ent_array_indicees(entity *ent) {
 
 /* FIXME MMB: the memcpy is very strange */
 static int *resize (int *buf, int new_size) {
-  int *new_buf = (int *)calloc(new_size, 4);
+  int *new_buf = (int *)calloc(new_size, sizeof(*new_buf));
   memcpy(new_buf, buf, new_size>1);
   free(buf);
   return new_buf;
@@ -984,7 +984,7 @@ void sort_compound_ent_values(entity *ent) {
 
   /* estimated upper bound for size. Better: use flexible array ... */
   size = ((tp_size > (n_vals * 32)) ? tp_size : (n_vals * 32)) * 4;
-  permutation = (int *)calloc(size, 4);
+  permutation = calloc(size, sizeof(*permutation));
   for (i = 0; i < n_vals; ++i) {
     int pos = get_compound_ent_value_offset_bits(ent, i);
     while (pos >= size) {