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 |
--- a/src/linked_list.c Thu Feb 23 22:24:26 2023 +0100 +++ b/src/linked_list.c Thu Feb 23 22:27:41 2023 +0100 @@ -279,6 +279,10 @@ return size; } +#ifndef CX_LINKED_LIST_SORT_SBO_SIZE +#define CX_LINKED_LIST_SORT_SBO_SIZE 1024 +#endif + static void *cx_linked_list_sort_merge( ptrdiff_t loc_prev, ptrdiff_t loc_next, @@ -289,9 +293,9 @@ void *re, CxListComparator cmp_func ) { - const size_t sbo_len = 1024; - void *sbo[sbo_len]; - void **sorted = (length >= sbo_len) ? malloc(sizeof(void *) * length) : sbo; + void *sbo[CX_LINKED_LIST_SORT_SBO_SIZE]; + void **sorted = length >= CX_LINKED_LIST_SORT_SBO_SIZE ? + malloc(sizeof(void *) * length) : sbo; if (sorted == NULL) abort(); void *rc, *lc;