fixup printfs, don't put environments on the stack
[libfirm] / ir / ana2 / pto_util.c
index 7b0fc91..3b900f0 100644 (file)
@@ -76,9 +76,11 @@ ir_node **find_irg_args (ir_graph *graph)
 {
   type *tp = get_entity_type (get_irg_entity (graph));
   const int n_args = get_method_n_params (tp);
-  ir_node **args = xmalloc (sizeof(*args) * (n_args+1));
+  ir_node **args = xcalloc (n_args + 1, sizeof (ir_node*));
   ir_node *arg = get_irg_args (graph);
-  find_irg_args_env_t *arg_env = xmalloc(sizeof(*arg_env));
+  find_irg_args_env_t *arg_env;
+
+  arg_env = (find_irg_args_env_t*) xmalloc (sizeof (find_irg_args_env_t));
 
   arg_env->args = args;
   arg_env->arg  = arg;
@@ -91,8 +93,8 @@ ir_node **find_irg_args (ir_graph *graph)
     set_current_ir_graph (save);
   }
 
-  memset (arg_env, 0x00, sizeof (find_irg_args_env_t));
-  free (arg_env);
+   memset (arg_env, 0x00, sizeof (find_irg_args_env_t));
+   free (arg_env);
 
   args [n_args] = NULL;
 
@@ -150,6 +152,13 @@ int is_dummy_load_ptr (ir_node *ptr)
 \f
 /*
   $Log$
+  Revision 1.15  2005/01/10 17:26:34  liekweg
+  fixup printfs, don't put environments on the stack
+
+  Revision 1.14  2004/12/23 15:47:09  beck
+  removed uneeded allocations
+  used new xcalloc
+
   Revision 1.13  2004/12/22 14:43:14  beck
   made allocations C-like