Get rid of file_list_get_size calls - one line wrapper function

This commit is contained in:
twinaphex 2021-01-20 08:31:05 +01:00
parent 8359cfc29c
commit 7867c4b70e
6 changed files with 26 additions and 32 deletions

View File

@ -193,7 +193,7 @@ size_t file_list_get_size(const file_list_t *list)
size_t file_list_get_directory_ptr(const file_list_t *list)
{
size_t size = file_list_get_size(list);
size_t size = list->size;
return list->list[size].directory_ptr;
}

View File

@ -1409,7 +1409,7 @@ static void *ozone_list_get_entry(void *data,
}
break;
case MENU_LIST_HORIZONTAL:
list_size = file_list_get_size(&ozone->horizontal_list);
list_size = ozone->horizontal_list.size;
if (i < list_size)
return (void*)&ozone->horizontal_list.list[i];
break;
@ -3753,7 +3753,7 @@ size_t ozone_list_get_size(void *data, enum menu_list_type type)
case MENU_LIST_PLAIN:
return menu_entries_get_stack_size(0);
case MENU_LIST_HORIZONTAL:
return file_list_get_size(&ozone->horizontal_list);
return ozone->horizontal_list.size;
case MENU_LIST_TABS:
return ozone->system_tab_end;
}
@ -3763,7 +3763,7 @@ size_t ozone_list_get_size(void *data, enum menu_list_type type)
void ozone_free_list_nodes(file_list_t *list, bool actiondata)
{
unsigned i, size = (unsigned)file_list_get_size(list);
unsigned i, size = (unsigned)list->size;
for (i = 0; i < size; ++i)
{

View File

@ -507,7 +507,7 @@ void ozone_draw_entries(
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
entries_end = file_list_get_size(selection_buf);
entries_end = selection_buf->size;
y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.entry_padding_vertical;
sidebar_offset = ozone->sidebar_offset;
entry_width = video_width - (unsigned) ozone->dimensions_sidebar_width - ozone->sidebar_offset - entry_padding * 2 - ozone->animations.thumbnail_bar_position;

View File

@ -434,7 +434,7 @@ static void stripes_free_node(stripes_node_t *node)
*/
static void stripes_free_list_nodes(file_list_t *list, bool actiondata)
{
unsigned i, size = file_list_get_size(list);
unsigned i, size = list->size;
for (i = 0; i < size; ++i)
{
@ -503,7 +503,7 @@ static size_t stripes_list_get_size(void *data, enum menu_list_type type)
case MENU_LIST_PLAIN:
return menu_entries_get_stack_size(0);
case MENU_LIST_HORIZONTAL:
return file_list_get_size(&stripes->horizontal_list);
return stripes->horizontal_list.size;
case MENU_LIST_TABS:
return stripes->system_tab_end;
}
@ -528,7 +528,7 @@ static void *stripes_list_get_entry(void *data,
}
break;
case MENU_LIST_HORIZONTAL:
list_size = file_list_get_size(&stripes->horizontal_list);
list_size = stripes->horizontal_list.size;
if (i < list_size)
return (void*)&stripes->horizontal_list.list[i];
break;
@ -1195,9 +1195,7 @@ static void stripes_list_open_old(stripes_handle_t *stripes,
{
unsigned i, height = 0;
int threshold = stripes->icon_size * 10;
size_t end = 0;
end = file_list_get_size(list);
size_t end = list->size;
video_driver_get_size(NULL, &height);
@ -1255,9 +1253,9 @@ static void stripes_list_open_new(stripes_handle_t *stripes,
{
unsigned i, height;
unsigned stripes_system_tab = 0;
size_t skip = 0;
int threshold = stripes->icon_size * 10;
size_t end = file_list_get_size(list);
size_t skip = 0;
int threshold = stripes->icon_size * 10;
size_t end = list->size;
video_driver_get_size(NULL, &height);
@ -1401,7 +1399,7 @@ static void stripes_list_switch_old(stripes_handle_t *stripes,
file_list_t *list, int dir, size_t current)
{
unsigned i, first, last, height;
size_t end = file_list_get_size(list);
size_t end = list->size;
float ix = -stripes->icon_spacing_horizontal * dir;
float ia = 0;
@ -1474,8 +1472,7 @@ static void stripes_list_switch_new(stripes_handle_t *stripes,
}
}
end = file_list_get_size(list);
end = list->size;
first = 0;
last = end > 0 ? end - 1 : 0;
@ -2557,7 +2554,7 @@ static void stripes_draw_items(
core_node = stripes_get_userdata_from_horizontal_list(
stripes, (unsigned)(cat_selection_ptr - (stripes->system_tab_end + 1)));
end = file_list_get_size(list);
end = list->size;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = 0;
@ -3256,7 +3253,7 @@ static void stripes_layout(stripes_handle_t *stripes)
return;
current = (unsigned)stripes->selection_ptr_old;
end = (unsigned)file_list_get_size(&stripes->selection_buf_old);
end = (unsigned)stripes->selection_buf_old.size;
for (i = 0; i < end; i++)
{

View File

@ -679,7 +679,7 @@ static void xmb_free_node(xmb_node_t *node)
*/
static void xmb_free_list_nodes(file_list_t *list, bool actiondata)
{
unsigned i, size = (unsigned)file_list_get_size(list);
unsigned i, size = (unsigned)list->size;
for (i = 0; i < size; ++i)
{
@ -773,7 +773,7 @@ static size_t xmb_list_get_size(void *data, enum menu_list_type type)
case MENU_LIST_PLAIN:
return menu_entries_get_stack_size(0);
case MENU_LIST_HORIZONTAL:
return file_list_get_size(&xmb->horizontal_list);
return xmb->horizontal_list.size;
case MENU_LIST_TABS:
return xmb->system_tab_end;
}
@ -798,7 +798,7 @@ static void *xmb_list_get_entry(void *data,
}
break;
case MENU_LIST_HORIZONTAL:
list_size = file_list_get_size(&xmb->horizontal_list);
list_size = xmb->horizontal_list.size;
if (i < list_size)
return (void*)&xmb->horizontal_list.list[i];
break;
@ -1546,9 +1546,7 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
{
unsigned i, height = 0;
int threshold = xmb->icon_size * 10;
size_t end = 0;
end = file_list_get_size(list);
size_t end = list->size;
video_driver_get_size(NULL, &height);
@ -1607,7 +1605,7 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
unsigned xmb_system_tab = 0;
size_t skip = 0;
int threshold = xmb->icon_size * 10;
size_t end = file_list_get_size(list);
size_t end = list->size;
video_driver_get_size(NULL, &height);
@ -1767,7 +1765,7 @@ static void xmb_list_switch_old(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current)
{
unsigned i, height;
size_t end = file_list_get_size(list);
size_t end = list->size;
float ix = -xmb->icon_spacing_horizontal * dir;
float ia = 0;
unsigned first = 0;
@ -1840,8 +1838,7 @@ static void xmb_list_switch_new(xmb_handle_t *xmb,
}
}
end = file_list_get_size(list);
end = list->size;
first = 0;
last = (unsigned)(end > 0 ? end - 1 : 0);
@ -3478,7 +3475,7 @@ static void xmb_draw_items(
core_node = xmb_get_userdata_from_horizontal_list(
xmb, (unsigned)(cat_selection_ptr - (xmb->system_tab_end + 1)));
end = file_list_get_size(list);
end = list->size;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = 0;
@ -5445,7 +5442,7 @@ static void xmb_layout(xmb_handle_t *xmb)
return;
current = (unsigned)xmb->selection_ptr_old;
end = (unsigned)file_list_get_size(&xmb->selection_buf_old);
end = (unsigned)xmb->selection_buf_old.size;
for (i = 0; i < end; i++)
{

View File

@ -3372,7 +3372,7 @@ static unsigned menu_displaylist_parse_cores(
menu_entries_get_last_stack(&dir, NULL, NULL, NULL, NULL);
list_size = file_list_get_size(info->list);
list_size = info->list->size;
for (i = 0; i < list_size; i++)
{