libds

a collection of simple data structures
Log | Files | Refs | LICENSE

commit 333ddcee27671bb21b52565e81d0a8fabc15d6eb
parent 14b7a734b4a11d12aaec3addbd5cdc062b5c1768
Author: sin <sin@2f30.org>
Date:   Tue,  6 May 2014 13:16:12 +0100

No need to check s->top before free-ing

Diffstat:
Mstack.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/stack.c b/stack.c @@ -26,13 +26,11 @@ stack_free(struct stack *s) { struct stacknode *n, *tmp; - if (s->top) { - n = s->top; - while (n) { - tmp = n->next; - free(tmp); - n = tmp; - } + n = s->top; + while (n) { + tmp = n->next; + free(tmp); + n = tmp; } free(s); }