Don't use file_list_get_at_offset - access members directly

This commit is contained in:
twinaphex 2021-03-10 08:36:59 +01:00 committed by Autechre
parent 6629c20e25
commit a2031608e7
7 changed files with 71 additions and 126 deletions

View File

@ -411,14 +411,11 @@ static void menu_action_setting_disp_set_label_menu_file_core(
const char *path,
char *s2, size_t len2)
{
const char *alt = NULL;
strcpy_literal(s, "(CORE)");
file_list_get_at_offset(list, i, NULL, NULL, NULL, NULL);
alt = list->list[i].alt
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*w = (unsigned)strlen(s);
strcpy_literal(s, "(CORE)");
*w = (unsigned)strlen(s);
if (alt)
strlcpy(s2, alt, len2);
}
@ -434,15 +431,11 @@ static void menu_action_setting_disp_set_label_core_updater_entry(
{
core_updater_list_t *core_list = core_updater_list_get_cached();
const core_updater_list_entry_t *entry = NULL;
const char *alt = NULL;
*s = '\0';
*w = 0;
file_list_get_at_offset(list, i, NULL, NULL, NULL, NULL);
alt = list->list[i].alt
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 0;
if (alt)
strlcpy(s2, alt, len2);
@ -487,16 +480,12 @@ static void menu_action_setting_disp_set_label_core_manager_entry(
const char *path,
char *s2, size_t len2)
{
const char *alt = NULL;
core_info_ctx_find_t core_info;
*s = '\0';
*w = 0;
file_list_get_at_offset(list, i, NULL, NULL, NULL, NULL);
alt = list->list[i].alt
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 0;
if (alt)
strlcpy(s2, alt, len2);
@ -524,16 +513,12 @@ static void menu_action_setting_disp_set_label_core_lock(
const char *path,
char *s2, size_t len2)
{
const char *alt = NULL;
core_info_ctx_find_t core_info;
*s = '\0';
*w = 0;
file_list_get_at_offset(list, i, NULL, NULL, NULL, NULL);
alt = list->list[i].alt
const char *alt = list->list[i].alt
? list->list[i].alt
: list->list[i].path;
*s = '\0';
*w = 0;
if (alt)
strlcpy(s2, alt, len2);

View File

@ -1469,11 +1469,8 @@ static int action_bind_sublabel_core_backup_entry(
const char *label, const char *path,
char *s, size_t len)
{
const char *crc = NULL;
/* crc is entered as 'alt' text */
file_list_get_at_offset(list, i, NULL, NULL, NULL, NULL);
crc = list->list[i].alt
const char *crc = list->list[i].alt
? list->list[i].alt
: list->list[i].path;

View File

@ -813,16 +813,12 @@ void ozone_init_horizontal_list(ozone_handle_t *ozone)
for (i = 0; i < list_size; i++)
{
const char *playlist_file = NULL;
char *console_name = NULL;
char playlist_file_noext[255];
char *console_name = NULL;
const char *playlist_file = ozone->horizontal_list.list[i].path;
playlist_file_noext[0] = '\0';
/* Get playlist file name */
file_list_get_at_offset(&ozone->horizontal_list, i,
&playlist_file, NULL, NULL, NULL);
if (!playlist_file)
{
file_list_set_alt_at_offset(&ozone->horizontal_list, i, NULL);
@ -907,16 +903,10 @@ void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
continue;
}
file_list_get_at_offset(&ozone->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path)
if (!(path = ozone->horizontal_list.list[i].path))
continue;
if (!string_ends_with_size(path, ".lpl",
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
continue;
{
struct texture_image ti;
char sysname[PATH_MAX_LENGTH];
@ -984,8 +974,6 @@ void ozone_context_reset_horizontal_list(ozone_handle_t *ozone)
}
/* Console name */
file_list_get_at_offset(
&ozone->horizontal_list, i, NULL, NULL, NULL, NULL);
console_name = ozone->horizontal_list.list[i].alt
? ozone->horizontal_list.list[i].alt
: ozone->horizontal_list.list[i].path;
@ -1017,15 +1005,14 @@ void ozone_context_destroy_horizontal_list(ozone_handle_t *ozone)
if (!node)
continue;
file_list_get_at_offset(&ozone->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
if (!(path = ozone->horizontal_list.list[i].path))
continue;
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
{
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
}
}
}

View File

@ -1512,12 +1512,8 @@ static void stripes_set_title(stripes_handle_t *stripes)
}
else
{
const char *path = NULL;
file_list_get_at_offset(
&stripes->horizontal_list,
stripes->categories_selection_ptr - (stripes->system_tab_end + 1),
&path, NULL, NULL, NULL);
const char *path = stripes->horizontal_list.list[
stripes->categories_selection_ptr - (stripes->system_tab_end + 1)].path;
if (!path)
return;
@ -1747,15 +1743,15 @@ static void stripes_context_destroy_horizontal_list(stripes_handle_t *stripes)
if (!node)
continue;
file_list_get_at_offset(&stripes->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
if (!(path = stripes->horizontal_list.list[i].path))
continue;
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
{
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
}
}
}
@ -1836,23 +1832,17 @@ static void stripes_context_reset_horizontal_list(
for (i = 0; i < list_size; i++)
{
const char *path = NULL;
stripes_node_t *node =
stripes_node_t *node =
stripes_get_userdata_from_horizontal_list(stripes, i);
if (!node)
{
node = stripes_node_allocate_userdata(stripes, i);
if (!node)
if (!(node = stripes_node_allocate_userdata(stripes, i)))
continue;
}
file_list_get_at_offset(&stripes->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
if (!(path = stripes->horizontal_list.list[i].path))
continue;
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
{
struct texture_image ti;
char sysname[256];

View File

@ -1879,11 +1879,8 @@ static void xmb_set_title(xmb_handle_t *xmb)
menu_entries_get_title(xmb->title_name, sizeof(xmb->title_name));
else
{
const char *path = NULL;
file_list_get_at_offset(&xmb->horizontal_list,
xmb->categories_selection_ptr - (xmb->system_tab_end + 1),
&path, NULL, NULL, NULL);
const char *path = xmb->horizontal_list.list[
xmb->categories_selection_ptr - (xmb->system_tab_end + 1)].path;
if (!path)
return;
@ -2093,16 +2090,14 @@ static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb)
if (!node)
continue;
file_list_get_at_offset(&xmb->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path || !string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
if (!(path = xmb->horizontal_list.list[i].path))
continue;
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
if (string_ends_with_size(path, ".lpl",
strlen(path), STRLEN_CONST(".lpl")))
{
video_driver_texture_unload(&node->icon);
video_driver_texture_unload(&node->content_icon);
}
}
}
@ -2185,16 +2180,10 @@ static void xmb_context_reset_horizontal_list(
xmb_get_userdata_from_horizontal_list(xmb, i);
if (!node)
{
node = xmb_node_allocate_userdata(xmb, i);
if (!node)
if (!(node = xmb_node_allocate_userdata(xmb, i)))
continue;
}
file_list_get_at_offset(&xmb->horizontal_list, i,
&path, NULL, NULL, NULL);
if (!path)
if (!(path = xmb->horizontal_list.list[i].path))
continue;
if (string_ends_with_size(path, ".lpl",

View File

@ -3460,10 +3460,8 @@ static unsigned menu_displaylist_parse_cores(
for (i = 0; i < list_size; i++)
{
unsigned type = 0;
const char *path = NULL;
file_list_get_at_offset(info->list, i, &path, NULL, &type, NULL);
const char *path = info->list->list[i].path;
unsigned type = info->list->list[i].type;
if (type == FILE_TYPE_CORE)
{

View File

@ -1939,17 +1939,20 @@ static int generic_menu_iterate(
#ifdef HAVE_NETWORKING
case MENU_ENUM_LABEL_CORE_UPDATER_ENTRY:
{
core_updater_list_t *core_list = core_updater_list_get_cached();
core_updater_list_t *core_list =
core_updater_list_get_cached();
const core_updater_list_entry_t *entry = NULL;
const char *path = NULL;
/* Get core path */
file_list_get_at_offset(selection_buf, selection, &path, NULL, NULL, NULL);
const char *path =
selection_buf->list[selection].path;
/* Search for specified core */
if (core_list && path &&
core_updater_list_get_filename(core_list, path, &entry) &&
!string_is_empty(entry->description))
if (
core_list
&& path
&& core_updater_list_get_filename(core_list,
path, &entry)
&& !string_is_empty(entry->description)
)
strlcpy(menu->menu_state_msg, entry->description,
sizeof(menu->menu_state_msg));
else
@ -1963,20 +1966,17 @@ static int generic_menu_iterate(
#endif
case MENU_ENUM_LABEL_CORE_MANAGER_ENTRY:
{
const char *path = NULL;
core_info_ctx_find_t core_info;
/* Get core path */
file_list_get_at_offset(selection_buf, selection, &path, NULL, NULL, NULL);
const char *path = selection_buf->list[selection].path;
/* Search for specified core */
core_info.inf = NULL;
core_info.path = path;
core_info.inf = NULL;
core_info.path = path;
if (path &&
core_info_find(&core_info) &&
!string_is_empty(core_info.inf->description))
strlcpy(menu->menu_state_msg, core_info.inf->description,
if ( path
&& core_info_find(&core_info)
&& !string_is_empty(core_info.inf->description))
strlcpy(menu->menu_state_msg,
core_info.inf->description,
sizeof(menu->menu_state_msg));
else
strlcpy(menu->menu_state_msg,
@ -2019,10 +2019,9 @@ static int generic_menu_iterate(
}
else
{
unsigned type = 0;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
size_t selection = menu_st->selection_ptr;
file_list_get_at_offset(selection_buf, selection, NULL, NULL, &type, NULL);
unsigned type = selection_buf->list[selection].type;
switch (type)
{