From 25a367862dbdfb0fdfdfc6f619af3f0a7e0fe79f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 30 Jun 2025 15:29:44 -0700 Subject: Use nullptr --- list/include/list.h | 8 ++++---- list/test/list_test.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'list') 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) { /// Create a new empty list. #define make_list(type) \ - (type##_list) { 0 } + (type##_list) { nullptr } /// Delete the list. #define del_list(list) \ @@ -32,7 +32,7 @@ static inline void* alloc(size_t size) { node = node->next; \ free(cur); \ } \ - list.head = 0; + list.head = nullptr; /// Prepend a value to the list. #define list_add(list, value) \ @@ -76,10 +76,10 @@ static inline void* alloc(size_t size) { node->next->prev = node->prev; \ } \ if (list.head == node) { \ - list.head = 0; \ + list.head = nullptr; \ } \ free(node); \ - node = 0; \ + node = nullptr; \ } /// 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) { TEST_CASE(list_remove_by_address) { const int N = 3; - int* ptrs[3] = {0}; + int* ptrs[3] = {nullptr}; int_list list = make_list(int); for (int i = 0; i < N; ++i) { -- cgit v1.2.3