mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 11:10:27 +00:00
file_list.c - cleanups
This commit is contained in:
parent
9701e28f8c
commit
3991fbf361
@ -55,27 +55,17 @@ void file_list_push(file_list_t *list,
|
||||
|
||||
size_t file_list_get_size(const file_list_t *list)
|
||||
{
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
return list->size;
|
||||
}
|
||||
|
||||
size_t file_list_get_directory_ptr(const file_list_t *list)
|
||||
{
|
||||
size_t size;
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
size = file_list_get_size(list);
|
||||
size_t size = file_list_get_size(list);
|
||||
return list->list[size].directory_ptr;
|
||||
}
|
||||
|
||||
void file_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (!(list->size == 0))
|
||||
{
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_delete)
|
||||
@ -94,9 +84,6 @@ void file_list_free(file_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
free(list->list[i].path);
|
||||
free(list->list);
|
||||
@ -107,9 +94,6 @@ void file_list_clear(file_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
free(list->list[i].path);
|
||||
@ -124,9 +108,6 @@ void file_list_clear(file_list_t *list)
|
||||
void file_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
const char *alt)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
free(list->list[index].alt);
|
||||
list->list[index].alt = strdup(alt);
|
||||
}
|
||||
@ -134,9 +115,6 @@ void file_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
void file_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
const char **alt)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (alt)
|
||||
*alt = list->list[index].alt ? list->list[index].alt : list->list[index].path;
|
||||
}
|
||||
@ -152,20 +130,12 @@ static int file_list_alt_cmp(const void *a_, const void *b_)
|
||||
|
||||
void file_list_sort_on_alt(file_list_t *list)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
qsort(list->list, list->size, sizeof(list->list[0]), file_list_alt_cmp);
|
||||
}
|
||||
|
||||
void file_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
const char **path, unsigned *file_type)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
if (!list->list)
|
||||
return;
|
||||
|
||||
if (path)
|
||||
*path = list->list[index].path;
|
||||
if (file_type)
|
||||
@ -175,9 +145,6 @@ void file_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
void file_list_get_last(const file_list_t *list,
|
||||
const char **path, unsigned *file_type)
|
||||
{
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (list->size)
|
||||
file_list_get_at_offset(list, list->size - 1, path, file_type);
|
||||
}
|
||||
@ -188,9 +155,6 @@ bool file_list_search(const file_list_t *list, const char *needle, size_t *index
|
||||
const char *alt;
|
||||
bool ret = false;
|
||||
|
||||
if (!list)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
const char *str;
|
||||
|
Loading…
Reference in New Issue
Block a user