Commit 77a5e3d1 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove xfree(), bitset_free() and use free() instead

parent 8890a7c6
......@@ -51,11 +51,6 @@ FIRM_API void *xrealloc(void *ptr, size_t size);
* error handling is required for code using it.
*/
FIRM_API char *xstrdup(const char *str);
/**
* Another name for the free function
* @deprecated
*/
#define xfree(ptr) free(ptr)
/**
* Allocate n objects of a certain type
......
......@@ -17,12 +17,6 @@
#include "util.h"
#include "xmalloc.h"
/* Undefine the macros to get the functions instead, cf tmalloc.c. */
#undef xmalloc
#undef xrealloc
#undef xstrdup
#undef xfree
/**
* An empty dynamic array descriptor.
*/
......
......@@ -40,7 +40,7 @@ void bipartite_free(bipartite_t *gr)
{
int i;
for (i = 0; i < gr->n_left; ++i)
bitset_free(gr->adj[i]);
free(gr->adj[i]);
free(gr);
}
......
......@@ -74,15 +74,6 @@ static inline bitset_t *bitset_malloc(size_t n_bits)
return bitset_init(memory, n_bits);
}
/**
* Free a bitset allocated with bitset_malloc().
* @param bs The bitset.
*/
static inline void bitset_free(bitset_t *bitset)
{
xfree(bitset);
}
/**
* Allocate a bitset on the stack via alloca.
* @param size The greatest bit that shall be stored in the set.
......
......@@ -78,11 +78,11 @@ void gs_delete_matrix(gs_matrix_t *m)
int i;
for (i = 0; i < m->c_rows; ++i) {
if (m->rows[i].c_cols)
xfree(m->rows[i].cols);
free(m->rows[i].cols);
}
if (m->c_rows)
xfree(m->rows);
xfree(m);
free(m->rows);
free(m);
}
unsigned gs_matrix_get_n_entries(const gs_matrix_t *m)
......@@ -124,7 +124,7 @@ void gs_matrix_trim_row_capacities(gs_matrix_t *m)
if (the_row->c_cols)
the_row->cols = XREALLOC(the_row->cols, col_val_t, the_row->c_cols);
else
xfree(the_row->cols);
free(the_row->cols);
}
}
}
......@@ -321,5 +321,5 @@ void gs_matrix_dump(const gs_matrix_t *m, int a, int b, FILE *out)
fprintf(out, "\n");
}
xfree(elems);
free(elems);
}
......@@ -161,10 +161,10 @@ void hungarian_remove(hungarian_problem_t *p, unsigned left, unsigned right)
void hungarian_free(hungarian_problem_t* p)
{
xfree(p->missing_left);
xfree(p->missing_right);
xfree(p->cost);
xfree(p);
free(p->missing_left);
free(p->missing_right);
free(p->cost);
free(p);
}
int hungarian_solve(hungarian_problem_t* p, unsigned *assignment,
......@@ -419,14 +419,14 @@ done:
DBG((dbg, LEVEL_1, "Cost is %d\n", res_cost));
xfree(slack);
xfree(col_inc);
xfree(parent_row);
xfree(row_mate);
xfree(slack_row);
xfree(row_dec);
xfree(unchosen_row);
xfree(col_mate);
free(slack);
free(col_inc);
free(parent_row);
free(row_mate);
free(slack_row);
free(row_dec);
free(unchosen_row);
free(col_mate);
if (final_cost != NULL)
*final_cost = res_cost;
......
......@@ -80,7 +80,7 @@ static inline void free_pdeq_block (pdeq *p)
if (pdeqs_cached < TUNE_NSAVED_PDEQS) {
pdeq_block_cache[pdeqs_cached++] = p;
} else {
xfree (p);
free (p);
}
}
......
......@@ -78,7 +78,7 @@ void plist_free(plist_t *list)
if (! list->foreign_obstack) {
obstack_free(list->obst, NULL);
xfree(list);
free(list);
}
}
......
......@@ -127,7 +127,7 @@ SET *(PMANGLE(new)) (MANGLEP(cmp_fun) cmp, size_t nslots)
void PMANGLE(del) (SET *table)
{
obstack_free (&table->obst, NULL);
xfree (table);
free (table);
}
size_t MANGLEP(count) (SET *table)
......
......@@ -828,11 +828,11 @@ static void reset_isbe(void)
ir_graph *irg = get_irp_irg(i);
if (irg->caller_isbe)
xfree(irg->caller_isbe);
free(irg->caller_isbe);
irg->caller_isbe = NULL;
if (irg->callee_isbe)
xfree(irg->callee_isbe);
free(irg->callee_isbe);
irg->callee_isbe = NULL;
}
}
......@@ -909,7 +909,7 @@ void analyse_loop_nesting_depth(void)
ir_entity **free_methods = NULL;
cgana(&free_methods);
xfree(free_methods);
free(free_methods);
}
if (irp_callgraph_consistent != get_irp_callgraph_state()) {
......
......@@ -155,7 +155,7 @@ void free_cdep(ir_graph *irg)
if (cdep_data != NULL) {
pmap_destroy(cdep_data->cdep_map);
obstack_free(&cdep_data->obst, NULL);
xfree(cdep_data);
free(cdep_data);
cdep_data = NULL;
}
}
......
......@@ -194,9 +194,9 @@ void dfs_free(dfs_t *dfs)
obstack_free(&dfs->obst, NULL);
del_set(dfs->nodes);
del_set(dfs->edges);
xfree(dfs->pre_order);
xfree(dfs->post_order);
xfree(dfs);
free(dfs->pre_order);
free(dfs->post_order);
free(dfs);
}
static void dfs_dump_edge(const dfs_edge_t *edge, FILE *file)
......@@ -264,5 +264,5 @@ void dfs_dump(const dfs_t *dfs, FILE *file)
dfs_dump_edge(edge, file);
ir_fprintf(file, "}\n");
xfree(nodes);
free(nodes);
}
......@@ -374,5 +374,5 @@ void ir_estimate_execfreq(ir_graph *irg)
dfs_free(dfs);
xfree(x);
free(x);
}
......@@ -239,5 +239,5 @@ void heights_free(ir_heights_t *h)
dump_remove_node_info_callback(h->dump_handle);
obstack_free(&h->obst, NULL);
ir_nodemap_destroy(&h->data);
xfree(h);
free(h);
}
......@@ -254,7 +254,7 @@ void lv_chk_free(lv_chk_t *lv)
dfs_free(lv->dfs);
obstack_free(&lv->obst, NULL);
ir_nodemap_destroy(&lv->block_infos);
xfree(lv);
free(lv);
}
unsigned lv_chk_bl_xxx(lv_chk_t *lv, const ir_node *bl, const ir_node *var)
......
......@@ -561,7 +561,7 @@ void set_vrp_data(ir_graph *irg)
env->visited = bitset_malloc(get_irg_last_idx(irg));
irg_walk_graph(irg, NULL, vrp_first_pass, env);
bitset_free(env->visited);
free(env->visited);
/* while there are entries in the worklist, continue*/
while (!waitq_empty(env->workqueue)) {
......
......@@ -237,7 +237,7 @@ void be_abihelper_finish(beabi_helper_env_t *env)
if (env->epilog.reg_index_map != NULL) {
free_rsm(&env->epilog, arch_env);
}
xfree(env);
free(env);
}
void be_prolog_add_reg(beabi_helper_env_t *env, const arch_register_t *reg,
......@@ -613,7 +613,7 @@ static void process_ops_in_block(ir_node *block, void *data)
ir_nodemap_insert(map, node, pred);
}
xfree(nodes);
free(nodes);
}
......
......@@ -305,7 +305,7 @@ static void post_spill(be_chordal_env_t *const chordal_env, ir_graph *const irg)
/* free some always allocated data structures */
pmap_destroy(chordal_env->border_heads);
bitset_free(chordal_env->allocatable_regs);
free(chordal_env->allocatable_regs);
}
/**
......
......@@ -477,8 +477,8 @@ static inline void free_qnode(qnode_t *qn)
{
del_set(qn->conflicts);
del_set(qn->changed_nodes);
xfree(qn->mis);
xfree(qn);
free(qn->mis);
free(qn);
}
/**
......
......@@ -988,7 +988,7 @@ static void process(co2_t *env)
DB((env->dbg, LEVEL_1, "all costs: %d, init costs: %d, final costs: %d\n", all_costs, init_costs, final_costs));
xfree(clouds);
free(clouds);
}
static int co_solve_heuristic_new(copy_opt_t *co)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment