From c24218fcee151701eb44daabf9d04bde2f60f7d7 Mon Sep 17 00:00:00 2001 From: Kevin Worth Date: Tue, 13 Apr 2010 02:13:59 -0400 Subject: [PATCH] Seg Fault bug and compiler warning fixes --- kub.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/kub.c b/kub.c index f76bb97..4132bd3 100644 --- a/kub.c +++ b/kub.c @@ -228,17 +228,13 @@ static int tile_compare(const void *one, const void *two) { const tile_t *tile_one = one; const tile_t *tile_two = two; - return tile_one->number - tile_two->number; + return tile_one->number - tile_two->number; //Sort lowest to highest } -static int tile_compare_1(tile_t *tile_one, tile_t *tile_two) +static int int_compare(const void *vx, const void *vy) { - return tile_one->number - tile_two->number; //Sort lowest to highest -} - -static int int_compare(int *x, int *y) -{ - return y - x; //Sort highest to lowest + const int *x = vx, *y = vy; + return *y - *x; //Sort highest to lowest } /* @@ -841,7 +837,7 @@ static gboolean on_button_release_event (GtkWidget *widget, GdkEventButton *even game->board.num_groups++; } board_print(game); - printf("\nBut is the board valid?\t\t%s\n", board_valid(&game->board)); + printf("\nBut is the board valid?\t\t%s\n", board_valid(&game->board) ? "yes" : "no"); } game->select_mode = 1; -- 2.43.0