diff options
Diffstat (limited to 'list')
-rw-r--r-- | list/include/list.h | 8 | ||||
-rw-r--r-- | list/test/list_test.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/list/include/list.h b/list/include/list.h index 24291e1..aadcb88 100644 --- a/list/include/list.h +++ b/list/include/list.h | |||
@@ -23,7 +23,7 @@ static inline void* alloc(size_t size) { | |||
23 | 23 | ||
24 | /// Create a new empty list. | 24 | /// Create a new empty list. |
25 | #define make_list(type) \ | 25 | #define make_list(type) \ |
26 | (type##_list) { 0 } | 26 | (type##_list) { nullptr } |
27 | 27 | ||
28 | /// Delete the list. | 28 | /// Delete the list. |
29 | #define del_list(list) \ | 29 | #define del_list(list) \ |
@@ -32,7 +32,7 @@ static inline void* alloc(size_t size) { | |||
32 | node = node->next; \ | 32 | node = node->next; \ |
33 | free(cur); \ | 33 | free(cur); \ |
34 | } \ | 34 | } \ |
35 | list.head = 0; | 35 | list.head = nullptr; |
36 | 36 | ||
37 | /// Prepend a value to the list. | 37 | /// Prepend a value to the list. |
38 | #define list_add(list, value) \ | 38 | #define list_add(list, value) \ |
@@ -76,10 +76,10 @@ static inline void* alloc(size_t size) { | |||
76 | node->next->prev = node->prev; \ | 76 | node->next->prev = node->prev; \ |
77 | } \ | 77 | } \ |
78 | if (list.head == node) { \ | 78 | if (list.head == node) { \ |
79 | list.head = 0; \ | 79 | list.head = nullptr; \ |
80 | } \ | 80 | } \ |
81 | free(node); \ | 81 | free(node); \ |
82 | node = 0; \ | 82 | node = nullptr; \ |
83 | } | 83 | } |
84 | 84 | ||
85 | /// Iterate over all the items in the list. | 85 | /// Iterate over all the items in the list. |
diff --git a/list/test/list_test.c b/list/test/list_test.c index 418e156..4ac5b5b 100644 --- a/list/test/list_test.c +++ b/list/test/list_test.c | |||
@@ -52,7 +52,7 @@ TEST_CASE(list_remove_by_value) { | |||
52 | TEST_CASE(list_remove_by_address) { | 52 | TEST_CASE(list_remove_by_address) { |
53 | const int N = 3; | 53 | const int N = 3; |
54 | 54 | ||
55 | int* ptrs[3] = {0}; | 55 | int* ptrs[3] = {nullptr}; |
56 | 56 | ||
57 | int_list list = make_list(int); | 57 | int_list list = make_list(int); |
58 | for (int i = 0; i < N; ++i) { | 58 | for (int i = 0; i < N; ++i) { |