1.1 --- a/src/linked_list.c Sun Jan 14 13:50:17 2024 +0100 1.2 +++ b/src/linked_list.c Mon Jan 15 20:59:18 2024 +0100 1.3 @@ -480,8 +480,6 @@ 1.4 1.5 // HIGH LEVEL LINKED LIST IMPLEMENTATION 1.6 1.7 -bool CX_DISABLE_LINKED_LIST_SWAP_SBO = false; 1.8 - 1.9 typedef struct cx_linked_list_node cx_linked_list_node; 1.10 struct cx_linked_list_node { 1.11 cx_linked_list_node *prev; 1.12 @@ -629,6 +627,7 @@ 1.13 #ifndef CX_LINKED_LIST_SWAP_SBO_SIZE 1.14 #define CX_LINKED_LIST_SWAP_SBO_SIZE 128 1.15 #endif 1.16 +unsigned cx_linked_list_swap_sbo_size = CX_LINKED_LIST_SWAP_SBO_SIZE; 1.17 1.18 static int cx_ll_swap( 1.19 struct cx_list_s *list, 1.20 @@ -653,6 +652,7 @@ 1.21 if (left < mid && right < mid) { 1.22 // case 1: both items left from mid 1.23 nleft = cx_ll_node_at(ll, left); 1.24 + assert(nleft != NULL); 1.25 nright = nleft; 1.26 for (size_t c = left; c < right; c++) { 1.27 nright = nright->next; 1.28 @@ -660,6 +660,7 @@ 1.29 } else if (left >= mid && right >= mid) { 1.30 // case 2: both items right from mid 1.31 nright = cx_ll_node_at(ll, right); 1.32 + assert(nright != NULL); 1.33 nleft = nright; 1.34 for (size_t c = right; c > left; c--) { 1.35 nleft = nleft->prev; 1.36 @@ -706,7 +707,7 @@ 1.37 } 1.38 } 1.39 1.40 - if (list->item_size > CX_LINKED_LIST_SWAP_SBO_SIZE || CX_DISABLE_LINKED_LIST_SWAP_SBO) { 1.41 + if (list->item_size > CX_LINKED_LIST_SWAP_SBO_SIZE) { 1.42 cx_linked_list_node *prev = nleft->prev; 1.43 cx_linked_list_node *next = nright->next; 1.44 cx_linked_list_node *midstart = nleft->next;