Better style for stack#free_stack.
This commit is contained in:
parent
e7706dfa4b
commit
f48a3cee38
@ -44,16 +44,13 @@ struct stack *duplicate_stack(struct stack *stack) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void free_stack(struct stack *stack) {
|
void free_stack(struct stack *stack) {
|
||||||
struct stack *tmp_stack;
|
struct stack *tmp;
|
||||||
|
|
||||||
while (stack) {
|
for (; stack; stack = tmp) {
|
||||||
tmp_stack = stack->next;
|
tmp = stack->next;
|
||||||
free_card(stack->card);
|
free_card(stack->card);
|
||||||
free(stack);
|
free(stack);
|
||||||
stack = tmp_stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty(struct stack *stack) {
|
bool empty(struct stack *stack) {
|
||||||
|
Loading…
Reference in New Issue
Block a user