Skip to content

Commit

Permalink
(file_list) Get rid of superfluous small functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Sep 4, 2022
1 parent dfb4b60 commit 1e035b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 73 deletions.
16 changes: 0 additions & 16 deletions libretro-common/include/lists/file_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ void file_list_free(file_list_t *list);

bool file_list_deinitialize(file_list_t *list);

bool file_list_initialize(file_list_t *list);

/**
* @brief makes the list big enough to contain at least nitems
*
Expand All @@ -100,27 +98,13 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr);

void file_list_clear(file_list_t *list);

size_t file_list_get_size(const file_list_t *list);

size_t file_list_get_directory_ptr(const file_list_t *list);

void file_list_free_userdata(const file_list_t *list, size_t index);

void file_list_free_actiondata(const file_list_t *list, size_t idx);

void file_list_set_label_at_offset(file_list_t *list, size_t index,
const char *label);

void file_list_get_label_at_offset(const file_list_t *list, size_t index,
const char **label);

void file_list_set_alt_at_offset(file_list_t *list, size_t index,
const char *alt);

void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr);

void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr);

void file_list_sort_on_alt(file_list_t *list);

void file_list_sort_on_type(file_list_t *list);
Expand Down
53 changes: 1 addition & 52 deletions libretro-common/lists/file_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ static bool file_list_deinitialize_internal(file_list_t *list)
return true;
}

bool file_list_initialize(file_list_t *list)
{
if (!list)
return false;

list->list = NULL;
list->capacity = 0;
list->size = 0;

return true;
}

bool file_list_reserve(file_list_t *list, size_t nitems)
{
const size_t item_size = sizeof(struct item_file);
Expand Down Expand Up @@ -170,19 +158,6 @@ bool file_list_append(file_list_t *list,
return true;
}

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 = list ? list->size : 0;
return list->list[size].directory_ptr;
}

void file_list_pop(file_list_t *list, size_t *directory_ptr)
{
if (!list)
Expand Down Expand Up @@ -248,21 +223,7 @@ void file_list_clear(file_list_t *list)
list->size = 0;
}

void file_list_set_label_at_offset(file_list_t *list, size_t idx,
const char *label)
{
if (!list)
return;

if (list->list[idx].label)
free(list->list[idx].label);
list->list[idx].alt = NULL;

if (label)
list->list[idx].label = strdup(label);
}

void file_list_get_label_at_offset(const file_list_t *list, size_t idx,
static void file_list_get_label_at_offset(const file_list_t *list, size_t idx,
const char **label)
{
if (!label || !list)
Expand Down Expand Up @@ -325,18 +286,6 @@ void *file_list_get_userdata_at_offset(const file_list_t *list, size_t idx)
return list->list[idx].userdata;
}

void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr)
{
if (list && ptr)
list->list[idx].userdata = ptr;
}

void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr)
{
if (list && ptr)
list->list[idx].actiondata = ptr;
}

void *file_list_get_actiondata_at_offset(const file_list_t *list, size_t idx)
{
if (!list)
Expand Down
12 changes: 9 additions & 3 deletions menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -4661,7 +4661,9 @@ static void ozone_refresh_horizontal_list(ozone_handle_t *ozone,

menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);

file_list_initialize(&ozone->horizontal_list);
ozone->horizontal_list.list = NULL;
ozone->horizontal_list.capacity = 0;
ozone->horizontal_list.size = 0;
ozone_init_horizontal_list(ozone, settings);

ozone_context_reset_horizontal_list(ozone);
Expand Down Expand Up @@ -7842,7 +7844,9 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
settings, width, height, false, false);
ozone->last_thumbnail_scale_factor = settings->floats.ozone_thumbnail_scale_factor;

file_list_initialize(&ozone->selection_buf_old);
ozone->selection_buf_old.list = NULL;
ozone->selection_buf_old.capacity = 0;
ozone->selection_buf_old.size = 0;

ozone->draw_sidebar = true;
ozone->sidebar_offset = 0;
Expand Down Expand Up @@ -7942,7 +7946,9 @@ static void *ozone_init(void **userdata, bool video_is_threaded)

gfx_display_init_white_texture();

file_list_initialize(&ozone->horizontal_list);
ozone->horizontal_list.list = NULL;
ozone->horizontal_list.capacity = 0;
ozone->horizontal_list.size = 0;

ozone_init_horizontal_list(ozone, settings);

Expand Down
8 changes: 6 additions & 2 deletions menu/drivers/xmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -6249,7 +6249,9 @@ static void *xmb_init(void **userdata, bool video_is_threaded)

*userdata = xmb;

file_list_initialize(&xmb->selection_buf_old);
xmb->selection_buf_old.list = NULL;
xmb->selection_buf_old.capacity = 0;
xmb->selection_buf_old.size = 0;

xmb->categories_active_idx = 0;
xmb->categories_active_idx_old = 0;
Expand Down Expand Up @@ -6311,7 +6313,9 @@ static void *xmb_init(void **userdata, bool video_is_threaded)

gfx_display_init_white_texture();

file_list_initialize(&xmb->horizontal_list);
xmb->horizontal_list.list = NULL;
xmb->horizontal_list.capacity = 0;
xmb->horizontal_list.size = 0;

xmb_init_horizontal_list(xmb);

Expand Down

0 comments on commit 1e035b9

Please sign in to comment.