From 539c0ecb0075b860e95add671d447f51ef41c525 Mon Sep 17 00:00:00 2001 From: Murilo Pereira Date: Mon, 9 May 2011 00:04:03 -0300 Subject: [PATCH] Conciseness. --- lib/stack.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/stack.c b/lib/stack.c index 8bcacc9..9d26f1b 100644 --- a/lib/stack.c +++ b/lib/stack.c @@ -58,11 +58,9 @@ bool empty(struct stack *stack) { } int length(struct stack *stack) { - int length; + int length = 0; - if (empty(stack)) { - length = 0; - } else { + if (!empty(stack)) { for (length = 1; stack->next; stack = stack->next, length++) ; }