From fbecf1b915cb050300ab2f06e95d1b8b51ba4f79 Mon Sep 17 00:00:00 2001 From: Michael Tryby Date: Wed, 10 Apr 2019 11:25:01 -0400 Subject: [PATCH] Fixing indent Spaces not tabs --- src/util/list.c | 35 ++++++++++++++++---------------- src/util/list.h | 16 +++++++-------- tests/util/test_errormanager.cpp | 10 ++++----- tests/util/test_list.cpp | 24 +++++++++++----------- 4 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/util/list.c b/src/util/list.c index 7fe5f36..3f87234 100644 --- a/src/util/list.c +++ b/src/util/list.c @@ -4,8 +4,8 @@ Version: 2.2 Module: util/list.h Description: Generic list - https://gist.github.com/pseudomuto/6334796#file-list-c - Accessed: April 9, 2019 + https://gist.github.com/pseudomuto/6334796#file-list-c + Accessed: April 9, 2019 Authors: David Muto, Modified by Michael E. Tryby Copyright: see AUTHORS License: see LICENSE @@ -29,8 +29,8 @@ list_t *create_list(size_t elementSize, freeFunction freeFn) { - list_t *list; - list = (list_t *)calloc(1, sizeof(list_t)); + list_t *list; + list = (list_t *)calloc(1, sizeof(list_t)); assert(elementSize > 0); list->logicalLength = 0; @@ -54,8 +54,7 @@ void delete_list(list_t *list) free(current->data); free(current); } - - free(list); + free(list); } void prepend_list(list_t *list, void *element) @@ -106,45 +105,45 @@ void for_each_list(list_t *list, listIterator iterator) } void *head_list(list_t *list, bool removeFromList) -// -// Warning: Caller is responsible for freeing the node->data returned. +// +// Warning: Caller is responsible for freeing the node->data returned. // { assert(list->head != NULL); listNode *node = list->head; - // Allocating and copying pointer to node data + // Allocating and copying pointer to node data void *element = (void *)malloc(list->elementSize); memcpy(element, node->data, list->elementSize); if(removeFromList) { - // Disconnecting head node + // Disconnecting head node list->head = node->next; list->logicalLength--; - // Freeing pointer to node->data and node + // Freeing pointer to node->data and node free(node->data); free(node); } - // Now element points to data formerly pointed to by node. Caller - // is responsible for freeing both pointer to data and data. + // Now element points to data formerly pointed to by node. Caller + // is responsible for freeing both pointer to data and data. return element; } void *tail_list(list_t *list) -// -// Warning: Caller is responsible for freeing the node->data returned. +// +// Warning: Caller is responsible for freeing the node->data returned. // { assert(list->tail != NULL); listNode *node = list->tail; - // Allocating and copying pointer to node data + // Allocating and copying pointer to node data void *element = (void *)malloc(list->elementSize); memcpy(element, node->data, list->elementSize); - // Pointer to element data gets returned. Caller is responsible - // for freeing pointer to data. + // Pointer to element data gets returned. Caller is responsible + // for freeing pointer to data. return element; } diff --git a/src/util/list.h b/src/util/list.h index 264975d..5a1ded7 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -4,7 +4,7 @@ Version: 2.2 Module: util/list.h Description: Generic list - https://gist.github.com/pseudomuto/6334796#file-list-h + https://gist.github.com/pseudomuto/6334796#file-list-h Accessed: April 9, 2019 Authors: David Muto, Modified by Michael E. Tryby Copyright: see AUTHORS @@ -29,17 +29,17 @@ typedef bool (*listIterator)(void *); typedef struct _listNode { - void *data; - struct _listNode *next; + void *data; + struct _listNode *next; } listNode; typedef struct { - int logicalLength; - size_t elementSize; - listNode *head; - listNode *tail; - freeFunction freeFn; + int logicalLength; + size_t elementSize; + listNode *head; + listNode *tail; + freeFunction freeFn; } list_t; diff --git a/tests/util/test_errormanager.cpp b/tests/util/test_errormanager.cpp index 43f59e2..8e70774 100644 --- a/tests/util/test_errormanager.cpp +++ b/tests/util/test_errormanager.cpp @@ -45,16 +45,16 @@ BOOST_AUTO_TEST_CASE (test_create_destroy) struct Fixture{ Fixture() { - error_message = NULL; + error_message = NULL; error_handle = create_error_manager(&mock_lookup); } ~Fixture() { delete_error_manager(error_handle); free(error_message); - } - int error; - error_handle_t *error_handle; - char *error_message; + } + int error; + error_handle_t *error_handle; + char *error_message; }; diff --git a/tests/util/test_list.cpp b/tests/util/test_list.cpp index 683c391..eb656f3 100644 --- a/tests/util/test_list.cpp +++ b/tests/util/test_list.cpp @@ -76,23 +76,23 @@ BOOST_AUTO_TEST_CASE(test_int_list){ struct FixtureStrings{ FixtureStrings() { - list = NULL; + list = NULL; int numNames = 5; const char *names[] = { "David", "Kevin", "Michael", "Craig", "Jimi" }; - list = create_list(sizeof(char *), free_string); - - char *name; - for (int i = 0; i < numNames; i++) { - name = _strdup(names[i]); - append_list(list, &name); - } + list = create_list(sizeof(char *), free_string); + + char *name; + for (int i = 0; i < numNames; i++) { + name = _strdup(names[i]); + append_list(list, &name); + } } ~FixtureStrings() { delete_list(list); - } - list_t *list; + } + list_t *list; }; BOOST_FIXTURE_TEST_CASE(test_string_list, FixtureStrings) { @@ -110,8 +110,8 @@ BOOST_FIXTURE_TEST_CASE(test_head_list, FixtureStrings) { BOOST_CHECK(check_string(*(char **)temp, "David")); BOOST_CHECK(size_list(list) == 4); - // To free a node, free both the data and reference to data - free_string(temp); + // To free a node, free both the data and reference to data + free_string(temp); free(temp); }