diff --git a/lib/card.c b/lib/card.c index 28073aa..73c02ec 100644 --- a/lib/card.c +++ b/lib/card.c @@ -25,9 +25,9 @@ void initialize_card(struct card *card) { return; } -void delete_card(struct card *card) { +void free_card(struct card *card) { if (card) { - delete_frame(card->frame); + free_frame(card->frame); } free(card); diff --git a/lib/card.h b/lib/card.h index e32ac67..766e3ad 100644 --- a/lib/card.h +++ b/lib/card.h @@ -45,7 +45,7 @@ extern const char *program_name; void allocate_card(struct card **); void initialize_card(struct card *); -void delete_card(struct card *); +void free_card(struct card *); void set_card(struct card *, enum value, enum suit, enum face, int, int); void expose_card(struct card *); void cover_card(struct card *); diff --git a/lib/deck.c b/lib/deck.c index 8ad7697..a1cfc09 100644 --- a/lib/deck.c +++ b/lib/deck.c @@ -50,22 +50,22 @@ void initialize_deck(struct deck *deck) { return; } -void delete_deck(struct deck *deck) { +void free_deck(struct deck *deck) { if (deck) { - delete_stack(deck->waste_pile); + free_stack(deck->waste_pile); - delete_stack(deck->foundation_0); - delete_stack(deck->foundation_1); - delete_stack(deck->foundation_2); - delete_stack(deck->foundation_3); + free_stack(deck->foundation_0); + free_stack(deck->foundation_1); + free_stack(deck->foundation_2); + free_stack(deck->foundation_3); - delete_stack(deck->maneuvre_0); - delete_stack(deck->maneuvre_1); - delete_stack(deck->maneuvre_2); - delete_stack(deck->maneuvre_3); - delete_stack(deck->maneuvre_4); - delete_stack(deck->maneuvre_5); - delete_stack(deck->maneuvre_6); + free_stack(deck->maneuvre_0); + free_stack(deck->maneuvre_1); + free_stack(deck->maneuvre_2); + free_stack(deck->maneuvre_3); + free_stack(deck->maneuvre_4); + free_stack(deck->maneuvre_5); + free_stack(deck->maneuvre_6); } free(deck); diff --git a/lib/deck.h b/lib/deck.h index 421d73c..4791554 100644 --- a/lib/deck.h +++ b/lib/deck.h @@ -41,6 +41,6 @@ extern const char *program_name; void allocate_deck(struct deck **); void initialize_deck(struct deck *); -void delete_deck(struct deck *); +void free_deck(struct deck *); #endif diff --git a/lib/frame.c b/lib/frame.c index 8eb7c60..06dbde2 100644 --- a/lib/frame.c +++ b/lib/frame.c @@ -22,7 +22,7 @@ void initialize_frame(struct frame *frame) { return; } -void delete_frame(struct frame *frame) { +void free_frame(struct frame *frame) { if (frame) { delwin(frame->shape); } diff --git a/lib/frame.h b/lib/frame.h index 5d412e8..04baebb 100644 --- a/lib/frame.h +++ b/lib/frame.h @@ -16,7 +16,7 @@ extern const char *program_name; void allocate_frame(struct frame **); void initialize_frame(struct frame *); -void delete_frame(struct frame *); +void free_frame(struct frame *); void set_frame(struct frame *, int, int); #endif diff --git a/lib/game.c b/lib/game.c index 5fe891c..ce2a676 100644 --- a/lib/game.c +++ b/lib/game.c @@ -224,7 +224,7 @@ void initialize_game() { } void end_game() { - delete_deck(deck); + free_deck(deck); return; } diff --git a/lib/stack.c b/lib/stack.c index 2394215..ff2a5ad 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -28,12 +28,12 @@ void initialize_stack(struct stack *stack) { return; } -void delete_stack(struct stack *stack) { +void free_stack(struct stack *stack) { struct stack *tmp_stack; while (stack) { tmp_stack = stack->next; - delete_card(stack->card); + free_card(stack->card); free(stack); stack = tmp_stack; } diff --git a/lib/stack.h b/lib/stack.h index 0702e16..578a1d8 100644 --- a/lib/stack.h +++ b/lib/stack.h @@ -35,7 +35,7 @@ extern const char *program_name; void allocate_stack(struct stack **); void initialize_stack(struct stack *); -void delete_stack(struct stack *); +void free_stack(struct stack *); bool empty(struct stack *); int length(struct stack *); void push(struct stack **, struct card *); diff --git a/test/card_test.c b/test/card_test.c index df2108d..41d29e7 100644 --- a/test/card_test.c +++ b/test/card_test.c @@ -11,7 +11,7 @@ void test_initialize_card() { assert(card->suit == NO_SUIT); assert(card->face == NO_FACE); - delete_card(card); + free_card(card); return; } @@ -31,7 +31,7 @@ void test_set_card() { assert(card->frame->start_y == start_y); assert(card->frame->start_x == start_x); - delete_card(card); + free_card(card); return; } @@ -45,7 +45,7 @@ void test_expose_card() { assert(card->face == EXPOSED); - delete_card(card); + free_card(card); return; } @@ -59,7 +59,7 @@ void test_cover_card() { assert(card->face == COVERED); - delete_card(card); + free_card(card); return; } diff --git a/test/frame_test.c b/test/frame_test.c index 12e7b05..ec2d0ed 100644 --- a/test/frame_test.c +++ b/test/frame_test.c @@ -11,7 +11,7 @@ void test_initialize_frame() { assert(frame->start_y == 0); assert(frame->start_x == 0); - delete_frame(frame); + free_frame(frame); return; } @@ -28,7 +28,7 @@ void test_set_frame() { assert(frame->start_y == start_y); assert(frame->start_x == start_x); - delete_frame(frame); + free_frame(frame); return; } diff --git a/test/stack_test.c b/test/stack_test.c index 934e6aa..82c18ae 100644 --- a/test/stack_test.c +++ b/test/stack_test.c @@ -11,7 +11,7 @@ void test_initialize_stack() { assert(stack->card->value == NO_VALUE); assert(!stack->next); - delete_stack(stack); + free_stack(stack); return; } @@ -24,7 +24,7 @@ void test_empty_on_empty_stack() { assert(empty(stack)); - delete_stack(stack); + free_stack(stack); return; } @@ -43,7 +43,7 @@ void test_empty_on_non_empty_stack() { assert(!empty(stack)); - delete_stack(stack); + free_stack(stack); return; } @@ -63,7 +63,7 @@ void test_push_on_empty_stack() { assert(stack->card == card); assert(!stack->next); - delete_stack(stack); + free_stack(stack); return; } @@ -88,7 +88,7 @@ void test_push_on_non_empty_stack() { assert(stack->next->card == card_0); assert(!stack->next->next); - delete_stack(stack); + free_stack(stack); return; } @@ -104,7 +104,7 @@ void test_push_null_on_empty_stack() { assert(stack->card == old_stack->card); assert(stack->next == NULL); - delete_stack(stack); + free_stack(stack); return; } @@ -125,7 +125,7 @@ void test_push_null_on_non_empty_stack() { assert(stack->card == old_stack->card); assert(stack->next == old_stack->next); - delete_stack(stack); + free_stack(stack); return; } @@ -142,7 +142,7 @@ void test_pop_on_empty_stack() { assert(empty(stack)); assert(!popped_entry); - delete_stack(stack); + free_stack(stack); return; } @@ -164,7 +164,7 @@ void test_pop_on_stack_with_one_element() { assert(popped_entry->card == card); assert(!popped_entry->next); - delete_stack(stack); + free_stack(stack); return; } @@ -189,7 +189,7 @@ void test_pop_on_stack_with_more_than_one_element() { assert(popped_entry->card == card[2]); assert(!popped_entry->next); - delete_stack(stack); + free_stack(stack); return; } @@ -214,8 +214,8 @@ void test_move_card_from_empty_stack_to_empty_stack() { assert(destination == new_destination); assert(stacks_equal(destination, destination_duplicate)); - delete_stack(origin); - delete_stack(destination); + free_stack(origin); + free_stack(destination); return; } @@ -246,8 +246,8 @@ void test_move_card_from_empty_stack_to_non_empty_stack() { assert(destination == new_destination); assert(stacks_equal(destination, destination_duplicate)); - delete_stack(origin); - delete_stack(destination); + free_stack(origin); + free_stack(destination); return; } @@ -271,8 +271,8 @@ void test_move_card_from_non_empty_stack_to_empty_stack() { assert(length(destination) == 1); assert(cards_equal(destination->card, card)); - delete_stack(origin); - delete_stack(destination); + free_stack(origin); + free_stack(destination); return; } @@ -301,8 +301,8 @@ void test_move_card_from_non_empty_stack_to_non_empty_stack() { assert(cards_equal(destination->card, card[0])); assert(cards_equal(destination->next->card, card[1])); - delete_stack(origin); - delete_stack(destination); + free_stack(origin); + free_stack(destination); return; } diff --git a/test/test_helper.c b/test/test_helper.c index 8681372..71960bc 100644 --- a/test/test_helper.c +++ b/test/test_helper.c @@ -72,7 +72,7 @@ struct stack *duplicate_stack(struct stack *stack) { while (!empty(tmp_stack)) { push(&new_stack, (pop(&tmp_stack))->card); } - delete_stack(tmp_stack); + free_stack(tmp_stack); return(new_stack); }