From: Kevin Worth Date: Tue, 13 Apr 2010 06:13:59 +0000 (-0400) Subject: Seg Fault bug and compiler warning fixes X-Git-Url: https://git.cworth.org/git?p=kub;a=commitdiff_plain;h=c24218fcee151701eb44daabf9d04bde2f60f7d7 Seg Fault bug and compiler warning fixes --- 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;