From 39038bc17e3b0e75083d61738d647dc512750586 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Tue, 9 Apr 2019 18:17:15 -0400 Subject: [PATCH] Fixing indentation --- src/util/list.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/util/list.c b/src/util/list.c index e1b8253..3aaa661 100644 --- a/src/util/list.c +++ b/src/util/list.c @@ -33,13 +33,13 @@ list_t *create_list(int elementSize, freeFunction freeFn) void delete_list(list_t *list) { listNode *current; + while(list->head != NULL) { current = list->head; list->head = current->next; - if (list->freeFn) { - list->freeFn(current->data); - } + if (list->freeFn) + list->freeFn(current->data); free(current->data); free(current); @@ -98,19 +98,17 @@ void for_each_list(list_t *list, listIterator iterator) void head_list(list_t *list, void **element, bool removeFromList) { assert(list->head != NULL); - - listNode *node = list->head; - *element = (void *)malloc(list->elementSize); + listNode *node = list->head; + *element = (void *)malloc(list->elementSize); memcpy(*element, node->data, list->elementSize); if(removeFromList) { list->head = node->next; list->logicalLength--; - if (list->freeFn) { - list->freeFn(node->data); - } + if (list->freeFn) + list->freeFn(node->data); free(node->data); free(node);