diff --git a/src/packages/compat/IZ_windows.h b/src/packages/compat/IZ_windows.h index bba40dd..4e846d6 100644 --- a/src/packages/compat/IZ_windows.h +++ b/src/packages/compat/IZ_windows.h @@ -3,7 +3,7 @@ #ifndef IZ_WINDOWS typedef int errno_t; -typedef unsigned int rsize_t; +typedef size_t rsize_t; #else #include #include diff --git a/src/packages/game/data/IZ_list.c b/src/packages/game/data/IZ_list.c index 122ebfc..e8eb82e 100644 --- a/src/packages/game/data/IZ_list.c +++ b/src/packages/game/data/IZ_list.c @@ -83,7 +83,6 @@ void IZ_ListTeardown(IZ_List* list) { while (list->length > 0) { IZ_ListDoDeleteNode(list->root); } - IZ_free(list); } /** diff --git a/src/packages/game/data/data.test.c b/src/packages/game/data/data.test.c index 9503e29..b958599 100644 --- a/src/packages/game/data/data.test.c +++ b/src/packages/game/data/data.test.c @@ -64,7 +64,7 @@ spec("data") { } it("removes all nodes from the list") { - mock_set_expected_calls(IZ_free, 4); + mock_set_expected_calls(IZ_free, 3); IZ_ListTeardown(&list); unsigned int expected_calls = mock_get_expected_calls(IZ_free); unsigned int actual_calls = mock_get_actual_calls(IZ_free); @@ -87,14 +87,13 @@ spec("data") { before_each() { IZ_ListInitialize(&list2); static u64 existing_value = 69420u; - static IZ_ListNode existing_node = { - .list = NULL, - .previous = NULL, - .value = &existing_value, - .next = NULL, - }; - list2.root = &existing_node; - existing_node.list = &list2; + static IZ_ListNode* existing_node; + existing_node = IZ_malloc(sizeof(IZ_ListNode)); + existing_node->list = &list2; + existing_node->previous = NULL; + existing_node->value = &existing_value; + existing_node->next = NULL; + list2.root = existing_node; list2.length = 1; } diff --git a/src/packages/stdinc/IZ_stdlib.c b/src/packages/stdinc/IZ_stdlib.c index da2f137..5c0ae7d 100644 --- a/src/packages/stdinc/IZ_stdlib.c +++ b/src/packages/stdinc/IZ_stdlib.c @@ -10,4 +10,5 @@ void* IZ_calloc(unsigned int count, size_t size) { void IZ_free(void* p) { SDL_free(p); + p = NULL; }