From 1e035b938598a745d4b5966d64e68c8390526b68 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Sun, 4 Sep 2022 17:52:06 +0200 Subject: [PATCH] (file_list) Get rid of superfluous small functions --- libretro-common/include/lists/file_list.h | 16 ------- libretro-common/lists/file_list.c | 53 +---------------------- menu/drivers/ozone.c | 12 +++-- menu/drivers/xmb.c | 8 +++- 4 files changed, 16 insertions(+), 73 deletions(-) diff --git a/libretro-common/include/lists/file_list.h b/libretro-common/include/lists/file_list.h index 5969d6800f9..3f7ebadc2a8 100644 --- a/libretro-common/include/lists/file_list.h +++ b/libretro-common/include/lists/file_list.h @@ -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 * @@ -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); diff --git a/libretro-common/lists/file_list.c b/libretro-common/lists/file_list.c index 836db97523b..e7a4e9cbb90 100644 --- a/libretro-common/lists/file_list.c +++ b/libretro-common/lists/file_list.c @@ -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); @@ -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) @@ -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) @@ -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) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 94fe95e852d..b7a1d80827f 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -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); @@ -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; @@ -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); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 82fc84b652c..21b534f6919 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -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; @@ -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);