From ea9ff3cfb5611440856ef075b3d6dfdd5e21ba7e Mon Sep 17 00:00:00 2001 From: Murilo Pereira Date: Sun, 8 May 2011 16:58:18 -0300 Subject: [PATCH] No return on end of void functions. --- lib/card.c | 12 ------------ lib/cursor.c | 6 ------ lib/deck.c | 6 ------ lib/display.c | 16 ---------------- lib/frame.c | 8 -------- lib/game.c | 12 ------------ lib/stack.c | 4 ---- lib/util.c | 6 ------ test/card_test.c | 12 ------------ test/cursor_test.c | 2 -- test/deck_test.c | 2 -- test/display_test.c | 2 -- test/frame_test.c | 8 -------- test/game_test.c | 10 ---------- test/keyboard_test.c | 2 -- test/stack_test.c | 26 -------------------------- test/test_helper_test.c | 28 ---------------------------- test/util_test.c | 2 -- 18 files changed, 164 deletions(-) diff --git a/lib/card.c b/lib/card.c index e44b39d..ee3be10 100644 --- a/lib/card.c +++ b/lib/card.c @@ -12,8 +12,6 @@ void allocate_card(struct card **card) { } allocate_frame(&((*card)->frame)); - - return; } void initialize_card(struct card *card) { @@ -21,8 +19,6 @@ void initialize_card(struct card *card) { card->value = NO_VALUE; card->suit = NO_SUIT; card->face = NO_FACE; - - return; } struct card *duplicate_card(struct card *card) { @@ -44,8 +40,6 @@ void free_card(struct card *card) { free_frame(card->frame); } free(card); - - return; } void set_card(struct card *card, @@ -58,18 +52,12 @@ void set_card(struct card *card, card->value = value; card->suit = suit; card->face = face; - - return; } void expose_card(struct card *card) { card->face = EXPOSED; - - return; } void cover_card(struct card *card) { card->face = COVERED; - - return; } diff --git a/lib/cursor.c b/lib/cursor.c index 88f626d..1c74de4 100644 --- a/lib/cursor.c +++ b/lib/cursor.c @@ -13,15 +13,11 @@ void allocate_cursor(struct cursor **cursor) { fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1); exit(errno); } - - return; } void initialize_cursor(struct cursor *cursor) { cursor->x = CURSOR_STARTING_X; cursor->y = CURSOR_STARTING_Y; - - return; } void move_cursor(struct cursor *cursor, enum movement movement) { @@ -90,6 +86,4 @@ void move_cursor(struct cursor *cursor, enum movement movement) { * on the maneuvre's stacks causes */ refresh(); draw_deck(deck); - - return; } diff --git a/lib/deck.c b/lib/deck.c index a1cfc09..1f7eca0 100644 --- a/lib/deck.c +++ b/lib/deck.c @@ -26,8 +26,6 @@ void allocate_deck(struct deck **deck) { allocate_stack(&((*deck)->maneuvre_4)); allocate_stack(&((*deck)->maneuvre_5)); allocate_stack(&((*deck)->maneuvre_6)); - - return; } void initialize_deck(struct deck *deck) { @@ -46,8 +44,6 @@ void initialize_deck(struct deck *deck) { initialize_stack(deck->maneuvre_4); initialize_stack(deck->maneuvre_5); initialize_stack(deck->maneuvre_6); - - return; } void free_deck(struct deck *deck) { @@ -68,6 +64,4 @@ void free_deck(struct deck *deck) { free_stack(deck->maneuvre_6); } free(deck); - - return; } diff --git a/lib/display.c b/lib/display.c index ae496e6..a6549f5 100644 --- a/lib/display.c +++ b/lib/display.c @@ -74,8 +74,6 @@ void draw_value(struct card *card) { 4, 6 - (strlen(card_value(card->value)) - 1), card_value(card->value)); - - return; } void draw_suit(struct card *card) { @@ -93,22 +91,16 @@ void draw_suit(struct card *card) { } else { wattroff(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE)); } - - return; } void draw_front(struct card *card) { wbkgd(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE)); draw_value(card); draw_suit(card); - - return; } void draw_back(struct card *card) { wbkgd(card->frame->shape, COLOR_PAIR(WHITE_ON_BLUE)); - - return; } void draw_card(struct card *card) { @@ -119,8 +111,6 @@ void draw_card(struct card *card) { draw_back(card); } wrefresh(card->frame->shape); - - return; } void draw_stack(struct stack *stack) { @@ -162,18 +152,12 @@ void draw_deck(struct deck *deck) { draw_stack(deck->maneuvre_4); draw_stack(deck->maneuvre_5); draw_stack(deck->maneuvre_6); - - return; } void draw_cursor(struct cursor *cursor) { mvaddch(cursor->y, cursor->x, '*'); - - return; } void erase_cursor(struct cursor *cursor) { mvdelch(cursor->y, cursor->x); - - return; } diff --git a/lib/frame.c b/lib/frame.c index a1ea4fb..3717ace 100644 --- a/lib/frame.c +++ b/lib/frame.c @@ -10,16 +10,12 @@ void allocate_frame(struct frame **frame) { fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1); exit(errno); } - - return; } void initialize_frame(struct frame *frame) { frame->shape = NULL; frame->start_y = 0; frame->start_x = 0; - - return; } struct frame *duplicate_frame(struct frame *frame) { @@ -36,8 +32,6 @@ void free_frame(struct frame *frame) { delwin(frame->shape); } free(frame); - - return; } void set_frame(struct frame *frame, int start_y, int start_x) { @@ -47,6 +41,4 @@ void set_frame(struct frame *frame, int start_y, int start_x) { FRAME_WIDTH, frame->start_y, frame->start_x); - - return; } diff --git a/lib/game.c b/lib/game.c index 9e18ae2..13c4972 100644 --- a/lib/game.c +++ b/lib/game.c @@ -126,8 +126,6 @@ static void set_stacks_initial_coordinates(struct deck *deck) { set_frame(deck->maneuvre_6->card->frame, MANEUVRE_STARTING_Y, MANEUVRE_6_STARTING_X); - - return; } static void fill_deck(struct deck *deck) { @@ -192,8 +190,6 @@ static void fill_deck(struct deck *deck) { for (int i = 0; i < NUMBER_OF_CARDS; i++) { push(&(deck->stock), card[i]); } - - return; } static void shuffle_deck(struct deck *deck) { @@ -222,8 +218,6 @@ static void shuffle_deck(struct deck *deck) { for (int i = 0; i < NUMBER_OF_CARDS; i++) { push(&(deck->stock), stack[i]->card); } - - return; } static void deal_cards(struct deck *deck) { @@ -268,16 +262,12 @@ static void deal_cards(struct deck *deck) { move_card(&(deck->stock), &(deck->maneuvre_6)); expose_card(deck->maneuvre_6->card); - - return; } void greet_player() { mvprintw(10, 27, "Welcome to tty-solitaire."); mvprintw(11, 8, "Move with \u2190\u2191\u2192\u2193 or hjkl. Use the space bar to mark and move cards."); mvprintw(12, 19, "Press the space bar to play or q to quit."); - - return; } void initialize_game() { @@ -300,6 +290,4 @@ void initialize_game() { void end_game() { free_deck(deck); - - return; } diff --git a/lib/stack.c b/lib/stack.c index be20a73..7ec5fdb 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -13,15 +13,11 @@ void allocate_stack(struct stack **stack) { } allocate_card(&((*stack)->card)); - - return; } void initialize_stack(struct stack *stack) { initialize_card(stack->card); stack->next = NULL; - - return; } struct stack *duplicate_stack(struct stack *stack) { diff --git a/lib/util.c b/lib/util.c index 4e52df4..9b6522d 100644 --- a/lib/util.c +++ b/lib/util.c @@ -17,20 +17,14 @@ void initialize_curses() { init_pair(2, COLOR_RED, COLOR_WHITE); init_pair(3, COLOR_WHITE, COLOR_BLUE); init_pair(4, COLOR_WHITE, COLOR_GREEN); - - return; } void end_curses() { endwin(); puts("Game finished."); - - return; } void clear_screen() { clear(); refresh(); - - return; } diff --git a/test/card_test.c b/test/card_test.c index 3831d40..e8977ba 100644 --- a/test/card_test.c +++ b/test/card_test.c @@ -13,8 +13,6 @@ void test_initialize_card() { assert(card->face == NO_FACE); free_card(card); - - return; } void test_duplicate_card() { @@ -27,8 +25,6 @@ void test_duplicate_card() { assert(card_0 != card_1); assert(cards_equal(card_0, card_1)); - - return; } void test_set_card() { @@ -47,8 +43,6 @@ void test_set_card() { assert(card->frame->start_x == start_x); free_card(card); - - return; } void test_expose_card() { @@ -61,8 +55,6 @@ void test_expose_card() { assert(card->face == EXPOSED); free_card(card); - - return; } void test_cover_card() { @@ -75,8 +67,6 @@ void test_cover_card() { assert(card->face == COVERED); free_card(card); - - return; } void test_card() { @@ -85,6 +75,4 @@ void test_card() { test_set_card(); test_expose_card(); test_cover_card(); - - return; } diff --git a/test/cursor_test.c b/test/cursor_test.c index f85bf9d..cfad8be 100644 --- a/test/cursor_test.c +++ b/test/cursor_test.c @@ -4,6 +4,4 @@ void test_cursor() { assert(true); - - return; } diff --git a/test/deck_test.c b/test/deck_test.c index 283f4d6..4df7bd3 100644 --- a/test/deck_test.c +++ b/test/deck_test.c @@ -4,6 +4,4 @@ void test_deck() { assert(true); - - return; } diff --git a/test/display_test.c b/test/display_test.c index fd31659..0f771b7 100644 --- a/test/display_test.c +++ b/test/display_test.c @@ -4,6 +4,4 @@ void test_display() { assert(true); - - return; } diff --git a/test/frame_test.c b/test/frame_test.c index 71bc9df..8dc6054 100644 --- a/test/frame_test.c +++ b/test/frame_test.c @@ -13,8 +13,6 @@ void test_initialize_frame() { assert(frame->start_x == 0); free_frame(frame); - - return; } void test_duplicate_frame() { @@ -27,8 +25,6 @@ void test_duplicate_frame() { assert(frame_0 != frame_1); assert(frames_equal(frame_0, frame_1)); - - return; } void test_set_frame() { @@ -44,14 +40,10 @@ void test_set_frame() { assert(frame->start_x == start_x); free_frame(frame); - - return; } void test_frame() { test_initialize_frame(); test_duplicate_frame(); test_set_frame(); - - return; } diff --git a/test/game_test.c b/test/game_test.c index b2bc87d..8d8f983 100644 --- a/test/game_test.c +++ b/test/game_test.c @@ -25,8 +25,6 @@ void test_move_card_from_empty_stack_to_empty_stack() { free_stack(origin); free_stack(destination); - - return; } void test_move_card_from_empty_stack_to_non_empty_stack() { @@ -57,8 +55,6 @@ void test_move_card_from_empty_stack_to_non_empty_stack() { free_stack(origin); free_stack(destination); - - return; } void test_move_card_from_non_empty_stack_to_empty_stack() { @@ -82,8 +78,6 @@ void test_move_card_from_non_empty_stack_to_empty_stack() { free_stack(origin); free_stack(destination); - - return; } void test_move_card_from_non_empty_stack_to_non_empty_stack() { @@ -112,8 +106,6 @@ void test_move_card_from_non_empty_stack_to_non_empty_stack() { free_stack(origin); free_stack(destination); - - return; } void test_valid_move_from_stock_to_stock() { @@ -521,6 +513,4 @@ void test_game() { test_move_card_from_empty_stack_to_non_empty_stack(); test_move_card_from_non_empty_stack_to_empty_stack(); test_move_card_from_non_empty_stack_to_non_empty_stack(); - - return; } diff --git a/test/keyboard_test.c b/test/keyboard_test.c index 27021a8..b10b9d9 100644 --- a/test/keyboard_test.c +++ b/test/keyboard_test.c @@ -4,6 +4,4 @@ void test_keyboard() { assert(true); - - return; } diff --git a/test/stack_test.c b/test/stack_test.c index 154287a..ab37287 100644 --- a/test/stack_test.c +++ b/test/stack_test.c @@ -12,8 +12,6 @@ void test_initialize_stack() { assert(!stack->next); free_stack(stack); - - return; } void test_duplicate_stack() { @@ -32,8 +30,6 @@ void test_duplicate_stack() { assert(stack_0 != stack_1); assert(stacks_equal(stack_0, stack_1)); - - return; } void test_empty_on_empty_stack() { @@ -45,8 +41,6 @@ void test_empty_on_empty_stack() { assert(empty(stack)); free_stack(stack); - - return; } void test_empty_on_non_empty_stack() { @@ -64,8 +58,6 @@ void test_empty_on_non_empty_stack() { assert(!empty(stack)); free_stack(stack); - - return; } void test_length() { @@ -86,8 +78,6 @@ void test_length() { } free_stack(stack); - - return; } void test_push_on_empty_stack() { @@ -106,8 +96,6 @@ void test_push_on_empty_stack() { assert(!stack->next); free_stack(stack); - - return; } void test_push_on_non_empty_stack() { @@ -131,8 +119,6 @@ void test_push_on_non_empty_stack() { assert(!stack->next->next); free_stack(stack); - - return; } void test_push_null_on_empty_stack() { @@ -147,8 +133,6 @@ void test_push_null_on_empty_stack() { assert(!stack->next); free_stack(stack); - - return; } void test_push_null_on_non_empty_stack() { @@ -168,8 +152,6 @@ void test_push_null_on_non_empty_stack() { assert(stacks_equal(stack->next, old_stack->next)); free_stack(stack); - - return; } void test_pop_on_empty_stack() { @@ -185,8 +167,6 @@ void test_pop_on_empty_stack() { assert(!popped_entry); free_stack(stack); - - return; } void test_pop_on_stack_with_one_element() { @@ -207,8 +187,6 @@ void test_pop_on_stack_with_one_element() { assert(!popped_entry->next); free_stack(stack); - - return; } void test_pop_on_stack_with_more_than_one_element() { @@ -232,8 +210,6 @@ void test_pop_on_stack_with_more_than_one_element() { assert(!popped_entry->next); free_stack(stack); - - return; } void test_reverse_on_empty_stack() { @@ -339,6 +315,4 @@ void test_stack() { test_reverse_on_stack_with_one_element(); test_reverse_on_stack_with_more_than_one_element(); test_reverse_should_not_change_stack(); - - return; } diff --git a/test/test_helper_test.c b/test/test_helper_test.c index a3a0493..49c1190 100644 --- a/test/test_helper_test.c +++ b/test/test_helper_test.c @@ -3,8 +3,6 @@ void test_frames_equal_with_two_nulls() { assert(frames_equal(NULL, NULL)); - - return; } void test_frames_equal_with_one_null() { @@ -13,8 +11,6 @@ void test_frames_equal_with_one_null() { allocate_frame(&frame); assert(!frames_equal(frame, NULL)); assert(!frames_equal(NULL, frame)); - - return; } void test_frames_equal_with_two_equivalent_frames() { @@ -27,8 +23,6 @@ void test_frames_equal_with_two_equivalent_frames() { set_frame(frame_1, start_y, start_x); assert(frames_equal(frame_0, frame_1)); - - return; } void test_frames_equal_with_two_frame_pointers_to_the_same_address() { @@ -37,14 +31,10 @@ void test_frames_equal_with_two_frame_pointers_to_the_same_address() { allocate_frame(&frame); assert(frames_equal(frame, frame)); - - return; } void test_cards_equal_with_two_nulls() { assert(cards_equal(NULL, NULL)); - - return; } void test_cards_equal_with_one_null() { @@ -53,8 +43,6 @@ void test_cards_equal_with_one_null() { allocate_card(&card); assert(!cards_equal(card, NULL)); assert(!cards_equal(NULL, card)); - - return; } void test_cards_equal_with_two_equivalent_cards() { @@ -67,8 +55,6 @@ void test_cards_equal_with_two_equivalent_cards() { set_card(card_1, ACE, SPADES, EXPOSED, start_y, start_x); assert(cards_equal(card_0, card_1)); - - return; } void test_cards_equal_with_two_card_pointers_to_the_same_address() { @@ -77,14 +63,10 @@ void test_cards_equal_with_two_card_pointers_to_the_same_address() { allocate_card(&card); assert(cards_equal(card, card)); - - return; } void test_stacks_equal_with_two_nulls() { assert(stacks_equal(NULL, NULL)); - - return; } void test_stacks_equal_with_one_null() { @@ -93,8 +75,6 @@ void test_stacks_equal_with_one_null() { allocate_stack(&stack); assert(!stacks_equal(stack, NULL)); assert(!stacks_equal(NULL, stack)); - - return; } void test_stacks_equal_with_two_equivalent_stacks() { @@ -112,8 +92,6 @@ void test_stacks_equal_with_two_equivalent_stacks() { push(&stack_1, card_1); assert(stacks_equal(stack_0, stack_1)); - - return; } void test_stacks_equal_with_two_different_stacks() { @@ -131,8 +109,6 @@ void test_stacks_equal_with_two_different_stacks() { push(&stack_1, card_1); assert(!stacks_equal(stack_0, stack_1)); - - return; } void test_stacks_equal_with_two_stack_pointers_to_the_same_address() { @@ -141,8 +117,6 @@ void test_stacks_equal_with_two_stack_pointers_to_the_same_address() { allocate_stack(&stack); assert(stacks_equal(stack, stack)); - - return; } void test_test_helper() { @@ -160,6 +134,4 @@ void test_test_helper() { test_stacks_equal_with_two_equivalent_stacks(); test_stacks_equal_with_two_different_stacks(); test_stacks_equal_with_two_stack_pointers_to_the_same_address(); - - return; } diff --git a/test/util_test.c b/test/util_test.c index 98b2d40..bc57dfc 100644 --- a/test/util_test.c +++ b/test/util_test.c @@ -4,6 +4,4 @@ void test_util() { assert(true); - - return; }