No return on end of void functions.

This commit is contained in:
Murilo Pereira 2011-05-08 16:58:18 -03:00
parent f86f3357ae
commit ea9ff3cfb5
18 changed files with 0 additions and 164 deletions

View File

@ -12,8 +12,6 @@ void allocate_card(struct card **card) {
} }
allocate_frame(&((*card)->frame)); allocate_frame(&((*card)->frame));
return;
} }
void initialize_card(struct card *card) { void initialize_card(struct card *card) {
@ -21,8 +19,6 @@ void initialize_card(struct card *card) {
card->value = NO_VALUE; card->value = NO_VALUE;
card->suit = NO_SUIT; card->suit = NO_SUIT;
card->face = NO_FACE; card->face = NO_FACE;
return;
} }
struct card *duplicate_card(struct card *card) { struct card *duplicate_card(struct card *card) {
@ -44,8 +40,6 @@ void free_card(struct card *card) {
free_frame(card->frame); free_frame(card->frame);
} }
free(card); free(card);
return;
} }
void set_card(struct card *card, void set_card(struct card *card,
@ -58,18 +52,12 @@ void set_card(struct card *card,
card->value = value; card->value = value;
card->suit = suit; card->suit = suit;
card->face = face; card->face = face;
return;
} }
void expose_card(struct card *card) { void expose_card(struct card *card) {
card->face = EXPOSED; card->face = EXPOSED;
return;
} }
void cover_card(struct card *card) { void cover_card(struct card *card) {
card->face = COVERED; card->face = COVERED;
return;
} }

View File

@ -13,15 +13,11 @@ void allocate_cursor(struct cursor **cursor) {
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1); fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
exit(errno); exit(errno);
} }
return;
} }
void initialize_cursor(struct cursor *cursor) { void initialize_cursor(struct cursor *cursor) {
cursor->x = CURSOR_STARTING_X; cursor->x = CURSOR_STARTING_X;
cursor->y = CURSOR_STARTING_Y; cursor->y = CURSOR_STARTING_Y;
return;
} }
void move_cursor(struct cursor *cursor, enum movement movement) { 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 */ * on the maneuvre's stacks causes */
refresh(); refresh();
draw_deck(deck); draw_deck(deck);
return;
} }

View File

@ -26,8 +26,6 @@ void allocate_deck(struct deck **deck) {
allocate_stack(&((*deck)->maneuvre_4)); allocate_stack(&((*deck)->maneuvre_4));
allocate_stack(&((*deck)->maneuvre_5)); allocate_stack(&((*deck)->maneuvre_5));
allocate_stack(&((*deck)->maneuvre_6)); allocate_stack(&((*deck)->maneuvre_6));
return;
} }
void initialize_deck(struct deck *deck) { 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_4);
initialize_stack(deck->maneuvre_5); initialize_stack(deck->maneuvre_5);
initialize_stack(deck->maneuvre_6); initialize_stack(deck->maneuvre_6);
return;
} }
void free_deck(struct deck *deck) { void free_deck(struct deck *deck) {
@ -68,6 +64,4 @@ void free_deck(struct deck *deck) {
free_stack(deck->maneuvre_6); free_stack(deck->maneuvre_6);
} }
free(deck); free(deck);
return;
} }

View File

@ -74,8 +74,6 @@ void draw_value(struct card *card) {
4, 4,
6 - (strlen(card_value(card->value)) - 1), 6 - (strlen(card_value(card->value)) - 1),
card_value(card->value)); card_value(card->value));
return;
} }
void draw_suit(struct card *card) { void draw_suit(struct card *card) {
@ -93,22 +91,16 @@ void draw_suit(struct card *card) {
} else { } else {
wattroff(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE)); wattroff(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE));
} }
return;
} }
void draw_front(struct card *card) { void draw_front(struct card *card) {
wbkgd(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE)); wbkgd(card->frame->shape, COLOR_PAIR(BLACK_ON_WHITE));
draw_value(card); draw_value(card);
draw_suit(card); draw_suit(card);
return;
} }
void draw_back(struct card *card) { void draw_back(struct card *card) {
wbkgd(card->frame->shape, COLOR_PAIR(WHITE_ON_BLUE)); wbkgd(card->frame->shape, COLOR_PAIR(WHITE_ON_BLUE));
return;
} }
void draw_card(struct card *card) { void draw_card(struct card *card) {
@ -119,8 +111,6 @@ void draw_card(struct card *card) {
draw_back(card); draw_back(card);
} }
wrefresh(card->frame->shape); wrefresh(card->frame->shape);
return;
} }
void draw_stack(struct stack *stack) { 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_4);
draw_stack(deck->maneuvre_5); draw_stack(deck->maneuvre_5);
draw_stack(deck->maneuvre_6); draw_stack(deck->maneuvre_6);
return;
} }
void draw_cursor(struct cursor *cursor) { void draw_cursor(struct cursor *cursor) {
mvaddch(cursor->y, cursor->x, '*'); mvaddch(cursor->y, cursor->x, '*');
return;
} }
void erase_cursor(struct cursor *cursor) { void erase_cursor(struct cursor *cursor) {
mvdelch(cursor->y, cursor->x); mvdelch(cursor->y, cursor->x);
return;
} }

View File

@ -10,16 +10,12 @@ void allocate_frame(struct frame **frame) {
fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1); fprintf(stderr, "%s: %s (%s:%d)\n", program_name, strerror(errno), __FILE__, __LINE__ - 1);
exit(errno); exit(errno);
} }
return;
} }
void initialize_frame(struct frame *frame) { void initialize_frame(struct frame *frame) {
frame->shape = NULL; frame->shape = NULL;
frame->start_y = 0; frame->start_y = 0;
frame->start_x = 0; frame->start_x = 0;
return;
} }
struct frame *duplicate_frame(struct frame *frame) { struct frame *duplicate_frame(struct frame *frame) {
@ -36,8 +32,6 @@ void free_frame(struct frame *frame) {
delwin(frame->shape); delwin(frame->shape);
} }
free(frame); free(frame);
return;
} }
void set_frame(struct frame *frame, int start_y, int start_x) { 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_WIDTH,
frame->start_y, frame->start_y,
frame->start_x); frame->start_x);
return;
} }

View File

@ -126,8 +126,6 @@ static void set_stacks_initial_coordinates(struct deck *deck) {
set_frame(deck->maneuvre_6->card->frame, set_frame(deck->maneuvre_6->card->frame,
MANEUVRE_STARTING_Y, MANEUVRE_STARTING_Y,
MANEUVRE_6_STARTING_X); MANEUVRE_6_STARTING_X);
return;
} }
static void fill_deck(struct deck *deck) { 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++) { for (int i = 0; i < NUMBER_OF_CARDS; i++) {
push(&(deck->stock), card[i]); push(&(deck->stock), card[i]);
} }
return;
} }
static void shuffle_deck(struct deck *deck) { 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++) { for (int i = 0; i < NUMBER_OF_CARDS; i++) {
push(&(deck->stock), stack[i]->card); push(&(deck->stock), stack[i]->card);
} }
return;
} }
static void deal_cards(struct deck *deck) { 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)); move_card(&(deck->stock), &(deck->maneuvre_6));
expose_card(deck->maneuvre_6->card); expose_card(deck->maneuvre_6->card);
return;
} }
void greet_player() { void greet_player() {
mvprintw(10, 27, "Welcome to tty-solitaire."); 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(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."); mvprintw(12, 19, "Press the space bar to play or q to quit.");
return;
} }
void initialize_game() { void initialize_game() {
@ -300,6 +290,4 @@ void initialize_game() {
void end_game() { void end_game() {
free_deck(deck); free_deck(deck);
return;
} }

View File

@ -13,15 +13,11 @@ void allocate_stack(struct stack **stack) {
} }
allocate_card(&((*stack)->card)); allocate_card(&((*stack)->card));
return;
} }
void initialize_stack(struct stack *stack) { void initialize_stack(struct stack *stack) {
initialize_card(stack->card); initialize_card(stack->card);
stack->next = NULL; stack->next = NULL;
return;
} }
struct stack *duplicate_stack(struct stack *stack) { struct stack *duplicate_stack(struct stack *stack) {

View File

@ -17,20 +17,14 @@ void initialize_curses() {
init_pair(2, COLOR_RED, COLOR_WHITE); init_pair(2, COLOR_RED, COLOR_WHITE);
init_pair(3, COLOR_WHITE, COLOR_BLUE); init_pair(3, COLOR_WHITE, COLOR_BLUE);
init_pair(4, COLOR_WHITE, COLOR_GREEN); init_pair(4, COLOR_WHITE, COLOR_GREEN);
return;
} }
void end_curses() { void end_curses() {
endwin(); endwin();
puts("Game finished."); puts("Game finished.");
return;
} }
void clear_screen() { void clear_screen() {
clear(); clear();
refresh(); refresh();
return;
} }

View File

@ -13,8 +13,6 @@ void test_initialize_card() {
assert(card->face == NO_FACE); assert(card->face == NO_FACE);
free_card(card); free_card(card);
return;
} }
void test_duplicate_card() { void test_duplicate_card() {
@ -27,8 +25,6 @@ void test_duplicate_card() {
assert(card_0 != card_1); assert(card_0 != card_1);
assert(cards_equal(card_0, card_1)); assert(cards_equal(card_0, card_1));
return;
} }
void test_set_card() { void test_set_card() {
@ -47,8 +43,6 @@ void test_set_card() {
assert(card->frame->start_x == start_x); assert(card->frame->start_x == start_x);
free_card(card); free_card(card);
return;
} }
void test_expose_card() { void test_expose_card() {
@ -61,8 +55,6 @@ void test_expose_card() {
assert(card->face == EXPOSED); assert(card->face == EXPOSED);
free_card(card); free_card(card);
return;
} }
void test_cover_card() { void test_cover_card() {
@ -75,8 +67,6 @@ void test_cover_card() {
assert(card->face == COVERED); assert(card->face == COVERED);
free_card(card); free_card(card);
return;
} }
void test_card() { void test_card() {
@ -85,6 +75,4 @@ void test_card() {
test_set_card(); test_set_card();
test_expose_card(); test_expose_card();
test_cover_card(); test_cover_card();
return;
} }

View File

@ -4,6 +4,4 @@
void test_cursor() { void test_cursor() {
assert(true); assert(true);
return;
} }

View File

@ -4,6 +4,4 @@
void test_deck() { void test_deck() {
assert(true); assert(true);
return;
} }

View File

@ -4,6 +4,4 @@
void test_display() { void test_display() {
assert(true); assert(true);
return;
} }

View File

@ -13,8 +13,6 @@ void test_initialize_frame() {
assert(frame->start_x == 0); assert(frame->start_x == 0);
free_frame(frame); free_frame(frame);
return;
} }
void test_duplicate_frame() { void test_duplicate_frame() {
@ -27,8 +25,6 @@ void test_duplicate_frame() {
assert(frame_0 != frame_1); assert(frame_0 != frame_1);
assert(frames_equal(frame_0, frame_1)); assert(frames_equal(frame_0, frame_1));
return;
} }
void test_set_frame() { void test_set_frame() {
@ -44,14 +40,10 @@ void test_set_frame() {
assert(frame->start_x == start_x); assert(frame->start_x == start_x);
free_frame(frame); free_frame(frame);
return;
} }
void test_frame() { void test_frame() {
test_initialize_frame(); test_initialize_frame();
test_duplicate_frame(); test_duplicate_frame();
test_set_frame(); test_set_frame();
return;
} }

View File

@ -25,8 +25,6 @@ void test_move_card_from_empty_stack_to_empty_stack() {
free_stack(origin); free_stack(origin);
free_stack(destination); free_stack(destination);
return;
} }
void test_move_card_from_empty_stack_to_non_empty_stack() { 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(origin);
free_stack(destination); free_stack(destination);
return;
} }
void test_move_card_from_non_empty_stack_to_empty_stack() { 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(origin);
free_stack(destination); free_stack(destination);
return;
} }
void test_move_card_from_non_empty_stack_to_non_empty_stack() { 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(origin);
free_stack(destination); free_stack(destination);
return;
} }
void test_valid_move_from_stock_to_stock() { 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_empty_stack_to_non_empty_stack();
test_move_card_from_non_empty_stack_to_empty_stack(); test_move_card_from_non_empty_stack_to_empty_stack();
test_move_card_from_non_empty_stack_to_non_empty_stack(); test_move_card_from_non_empty_stack_to_non_empty_stack();
return;
} }

View File

@ -4,6 +4,4 @@
void test_keyboard() { void test_keyboard() {
assert(true); assert(true);
return;
} }

View File

@ -12,8 +12,6 @@ void test_initialize_stack() {
assert(!stack->next); assert(!stack->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_duplicate_stack() { void test_duplicate_stack() {
@ -32,8 +30,6 @@ void test_duplicate_stack() {
assert(stack_0 != stack_1); assert(stack_0 != stack_1);
assert(stacks_equal(stack_0, stack_1)); assert(stacks_equal(stack_0, stack_1));
return;
} }
void test_empty_on_empty_stack() { void test_empty_on_empty_stack() {
@ -45,8 +41,6 @@ void test_empty_on_empty_stack() {
assert(empty(stack)); assert(empty(stack));
free_stack(stack); free_stack(stack);
return;
} }
void test_empty_on_non_empty_stack() { void test_empty_on_non_empty_stack() {
@ -64,8 +58,6 @@ void test_empty_on_non_empty_stack() {
assert(!empty(stack)); assert(!empty(stack));
free_stack(stack); free_stack(stack);
return;
} }
void test_length() { void test_length() {
@ -86,8 +78,6 @@ void test_length() {
} }
free_stack(stack); free_stack(stack);
return;
} }
void test_push_on_empty_stack() { void test_push_on_empty_stack() {
@ -106,8 +96,6 @@ void test_push_on_empty_stack() {
assert(!stack->next); assert(!stack->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_push_on_non_empty_stack() { void test_push_on_non_empty_stack() {
@ -131,8 +119,6 @@ void test_push_on_non_empty_stack() {
assert(!stack->next->next); assert(!stack->next->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_push_null_on_empty_stack() { void test_push_null_on_empty_stack() {
@ -147,8 +133,6 @@ void test_push_null_on_empty_stack() {
assert(!stack->next); assert(!stack->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_push_null_on_non_empty_stack() { 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)); assert(stacks_equal(stack->next, old_stack->next));
free_stack(stack); free_stack(stack);
return;
} }
void test_pop_on_empty_stack() { void test_pop_on_empty_stack() {
@ -185,8 +167,6 @@ void test_pop_on_empty_stack() {
assert(!popped_entry); assert(!popped_entry);
free_stack(stack); free_stack(stack);
return;
} }
void test_pop_on_stack_with_one_element() { void test_pop_on_stack_with_one_element() {
@ -207,8 +187,6 @@ void test_pop_on_stack_with_one_element() {
assert(!popped_entry->next); assert(!popped_entry->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_pop_on_stack_with_more_than_one_element() { 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); assert(!popped_entry->next);
free_stack(stack); free_stack(stack);
return;
} }
void test_reverse_on_empty_stack() { 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_one_element();
test_reverse_on_stack_with_more_than_one_element(); test_reverse_on_stack_with_more_than_one_element();
test_reverse_should_not_change_stack(); test_reverse_should_not_change_stack();
return;
} }

View File

@ -3,8 +3,6 @@
void test_frames_equal_with_two_nulls() { void test_frames_equal_with_two_nulls() {
assert(frames_equal(NULL, NULL)); assert(frames_equal(NULL, NULL));
return;
} }
void test_frames_equal_with_one_null() { void test_frames_equal_with_one_null() {
@ -13,8 +11,6 @@ void test_frames_equal_with_one_null() {
allocate_frame(&frame); allocate_frame(&frame);
assert(!frames_equal(frame, NULL)); assert(!frames_equal(frame, NULL));
assert(!frames_equal(NULL, frame)); assert(!frames_equal(NULL, frame));
return;
} }
void test_frames_equal_with_two_equivalent_frames() { 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); set_frame(frame_1, start_y, start_x);
assert(frames_equal(frame_0, frame_1)); assert(frames_equal(frame_0, frame_1));
return;
} }
void test_frames_equal_with_two_frame_pointers_to_the_same_address() { 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); allocate_frame(&frame);
assert(frames_equal(frame, frame)); assert(frames_equal(frame, frame));
return;
} }
void test_cards_equal_with_two_nulls() { void test_cards_equal_with_two_nulls() {
assert(cards_equal(NULL, NULL)); assert(cards_equal(NULL, NULL));
return;
} }
void test_cards_equal_with_one_null() { void test_cards_equal_with_one_null() {
@ -53,8 +43,6 @@ void test_cards_equal_with_one_null() {
allocate_card(&card); allocate_card(&card);
assert(!cards_equal(card, NULL)); assert(!cards_equal(card, NULL));
assert(!cards_equal(NULL, card)); assert(!cards_equal(NULL, card));
return;
} }
void test_cards_equal_with_two_equivalent_cards() { 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); set_card(card_1, ACE, SPADES, EXPOSED, start_y, start_x);
assert(cards_equal(card_0, card_1)); assert(cards_equal(card_0, card_1));
return;
} }
void test_cards_equal_with_two_card_pointers_to_the_same_address() { 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); allocate_card(&card);
assert(cards_equal(card, card)); assert(cards_equal(card, card));
return;
} }
void test_stacks_equal_with_two_nulls() { void test_stacks_equal_with_two_nulls() {
assert(stacks_equal(NULL, NULL)); assert(stacks_equal(NULL, NULL));
return;
} }
void test_stacks_equal_with_one_null() { void test_stacks_equal_with_one_null() {
@ -93,8 +75,6 @@ void test_stacks_equal_with_one_null() {
allocate_stack(&stack); allocate_stack(&stack);
assert(!stacks_equal(stack, NULL)); assert(!stacks_equal(stack, NULL));
assert(!stacks_equal(NULL, stack)); assert(!stacks_equal(NULL, stack));
return;
} }
void test_stacks_equal_with_two_equivalent_stacks() { 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); push(&stack_1, card_1);
assert(stacks_equal(stack_0, stack_1)); assert(stacks_equal(stack_0, stack_1));
return;
} }
void test_stacks_equal_with_two_different_stacks() { 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); push(&stack_1, card_1);
assert(!stacks_equal(stack_0, stack_1)); assert(!stacks_equal(stack_0, stack_1));
return;
} }
void test_stacks_equal_with_two_stack_pointers_to_the_same_address() { 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); allocate_stack(&stack);
assert(stacks_equal(stack, stack)); assert(stacks_equal(stack, stack));
return;
} }
void test_test_helper() { void test_test_helper() {
@ -160,6 +134,4 @@ void test_test_helper() {
test_stacks_equal_with_two_equivalent_stacks(); test_stacks_equal_with_two_equivalent_stacks();
test_stacks_equal_with_two_different_stacks(); test_stacks_equal_with_two_different_stacks();
test_stacks_equal_with_two_stack_pointers_to_the_same_address(); test_stacks_equal_with_two_stack_pointers_to_the_same_address();
return;
} }

View File

@ -4,6 +4,4 @@
void test_util() { void test_util() {
assert(true); assert(true);
return;
} }