allow final_cost pointer to be NULL
authorMatthias Braun <matze@braunis.de>
Sat, 5 Sep 2009 15:54:04 +0000 (15:54 +0000)
committerMatthias Braun <matze@braunis.de>
Sat, 5 Sep 2009 15:54:04 +0000 (15:54 +0000)
[r26495]

include/libfirm/adt/hungarian.h
ir/adt/hungarian.c

index 0744d69..9f9d4ba 100644 (file)
@@ -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_ */
index 0b3134a..26c4fe5 100644 (file)
@@ -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;
 }