From: Matthias Braun Date: Sat, 5 Sep 2009 15:54:04 +0000 (+0000) Subject: allow final_cost pointer to be NULL X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=7fbd7a186d870956996ce1fff2edea2ef4bdfaf0;p=libfirm allow final_cost pointer to be NULL [r26495] --- diff --git a/include/libfirm/adt/hungarian.h b/include/libfirm/adt/hungarian.h index 0744d699a..9f9d4bad4 100644 --- a/include/libfirm/adt/hungarian.h +++ b/include/libfirm/adt/hungarian.h @@ -92,6 +92,6 @@ int hungarian_solve(hungarian_problem_t *p, int *assignment, int *final_cost, in * @param p The hungarian object * @param cost_width The minimum field width of the costs */ -void hungarian_print_costmatrix(hungarian_problem_t *p, int cost_width); +void hungarian_print_cost_matrix(hungarian_problem_t *p, int cost_width); #endif /* _HUNGARIAN_H_ */ diff --git a/ir/adt/hungarian.c b/ir/adt/hungarian.c index 0b3134ab2..26c4fe597 100644 --- a/ir/adt/hungarian.c +++ b/ir/adt/hungarian.c @@ -71,7 +71,7 @@ static void hungarian_dump_f(FILE *f, int **C, int rows, int cols, int width) { fprintf(f, "\n"); } -void hungarian_print_costmatrix(hungarian_problem_t *p, int width) { +void hungarian_print_cost_matrix(hungarian_problem_t *p, int width) { hungarian_dump_f(stderr, p->cost, p->num_rows, p->num_cols, width); } @@ -441,7 +441,8 @@ done: xfree(unchosen_row); xfree(col_mate); - *final_cost = cost; + if (final_cost != NULL) + *final_cost = cost; return 0; }