mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-24 05:31:15 +00:00
(Libretro SDK) Add file_list_sort_on_type to file_list.c
This commit is contained in:
parent
7d3cbd58c6
commit
fe13a548f2
@ -168,11 +168,28 @@ static int file_list_alt_cmp(const void *a_, const void *b_)
|
||||
return strcasecmp(cmp_a, cmp_b);
|
||||
}
|
||||
|
||||
static int file_list_type_cmp(const void *a_, const void *b_)
|
||||
{
|
||||
const struct item_file *a = (const struct item_file*)a_;
|
||||
const struct item_file *b = (const struct item_file*)b_;
|
||||
if (a->type < b->type)
|
||||
return -1;
|
||||
if (a->type == b->type)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void file_list_sort_on_alt(file_list_t *list)
|
||||
{
|
||||
qsort(list->list, list->size, sizeof(list->list[0]), file_list_alt_cmp);
|
||||
}
|
||||
|
||||
void file_list_sort_on_type(file_list_t *list)
|
||||
{
|
||||
qsort(list->list, list->size, sizeof(list->list[0]), file_list_type_cmp);
|
||||
}
|
||||
|
||||
void *file_list_get_userdata_at_offset(const file_list_t *list, size_t idx)
|
||||
{
|
||||
if (!list)
|
||||
|
@ -94,6 +94,8 @@ void file_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
|
||||
void file_list_sort_on_alt(file_list_t *list);
|
||||
|
||||
void file_list_sort_on_type(file_list_t *list);
|
||||
|
||||
bool file_list_search(const file_list_t *list, const char *needle,
|
||||
size_t *index);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user