Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/sort/radixsort.c
Show First 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | sl->leaves = sort_realloc(sl->leaves, | ||||
(sizeof(struct sort_list_item*) * (sl->leaves_sz))); | (sizeof(struct sort_list_item*) * (sl->leaves_sz))); | ||||
} | } | ||||
sl->leaves[sl->leaves_num - 1] = item; | sl->leaves[sl->leaves_num - 1] = item; | ||||
} | } | ||||
static inline int | static inline int | ||||
get_wc_index(struct sort_list_item *sli, size_t level) | get_wc_index(struct sort_list_item *sli, size_t level) | ||||
{ | { | ||||
const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); | const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); | ||||
const struct key_value *kv; | const struct key_value *kv; | ||||
const struct bwstring *bws; | const struct bwstring *bws; | ||||
kv = get_key_from_keys_array(&sli->ka, 0); | kv = get_key_from_keys_array(&sli->ka, 0); | ||||
bws = kv->k; | bws = kv->k; | ||||
if ((BWSLEN(bws) * wcfact > level)) { | if ((BWSLEN(bws) * wcfact > level)) { | ||||
wchar_t res; | wchar_t res; | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if (sl) { | ||||
sort_free(sl); | sort_free(sl); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
run_sort_level_next(struct sort_level *sl) | run_sort_level_next(struct sort_level *sl) | ||||
{ | { | ||||
const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); | const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); | ||||
struct sort_level *slc; | struct sort_level *slc; | ||||
size_t i, sln, tosort_num; | size_t i, sln, tosort_num; | ||||
if (sl->sublevels) { | if (sl->sublevels) { | ||||
sort_free(sl->sublevels); | sort_free(sl->sublevels); | ||||
sl->sublevels = NULL; | sl->sublevels = NULL; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 386 Lines • Show Last 20 Lines |