From f48a3cee38d5305376c84c19f15fbaf88c776eec Mon Sep 17 00:00:00 2001 From: Murilo Pereira Date: Sun, 8 May 2011 01:22:26 -0300 Subject: [PATCH] Better style for stack#free_stack. --- lib/stack.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/stack.c b/lib/stack.c index 2c7c688..342b568 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -44,16 +44,13 @@ struct stack *duplicate_stack(struct stack *stack) { } void free_stack(struct stack *stack) { - struct stack *tmp_stack; + struct stack *tmp; - while (stack) { - tmp_stack = stack->next; + for (; stack; stack = tmp) { + tmp = stack->next; free_card(stack->card); free(stack); - stack = tmp_stack; } - - return; } bool empty(struct stack *stack) {