Thu, 23 Feb 2023 22:27:41 +0100
add CX_LINKED_LIST_SORT_SBO_SIZE macro
src/linked_list.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/linked_list.c Thu Feb 23 22:24:26 2023 +0100 1.2 +++ b/src/linked_list.c Thu Feb 23 22:27:41 2023 +0100 1.3 @@ -279,6 +279,10 @@ 1.4 return size; 1.5 } 1.6 1.7 +#ifndef CX_LINKED_LIST_SORT_SBO_SIZE 1.8 +#define CX_LINKED_LIST_SORT_SBO_SIZE 1024 1.9 +#endif 1.10 + 1.11 static void *cx_linked_list_sort_merge( 1.12 ptrdiff_t loc_prev, 1.13 ptrdiff_t loc_next, 1.14 @@ -289,9 +293,9 @@ 1.15 void *re, 1.16 CxListComparator cmp_func 1.17 ) { 1.18 - const size_t sbo_len = 1024; 1.19 - void *sbo[sbo_len]; 1.20 - void **sorted = (length >= sbo_len) ? malloc(sizeof(void *) * length) : sbo; 1.21 + void *sbo[CX_LINKED_LIST_SORT_SBO_SIZE]; 1.22 + void **sorted = length >= CX_LINKED_LIST_SORT_SBO_SIZE ? 1.23 + malloc(sizeof(void *) * length) : sbo; 1.24 if (sorted == NULL) abort(); 1.25 void *rc, *lc; 1.26