mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
Avoid using 'index' for local variables
This commit is contained in:
parent
b5088b96d0
commit
def41a573f
@ -10,7 +10,7 @@ typedef struct menu_file_list_cbs
|
||||
int (*action_deferred_push)(void *data, void *userdata, const char
|
||||
*path, const char *label, unsigned type);
|
||||
int (*action_ok)(const char *path, const char *label, unsigned type,
|
||||
size_t index);
|
||||
size_t idx);
|
||||
int (*action_start)(unsigned type, const char *label, unsigned action);
|
||||
int (*action_toggle)(unsigned type, const char *label, unsigned action);
|
||||
} menu_file_list_cbs_t;
|
||||
|
@ -674,34 +674,34 @@ static int menu_common_iterate(unsigned action)
|
||||
|
||||
static void menu_common_setting_set_label(char *type_str,
|
||||
size_t type_str_size, unsigned *w, unsigned type,
|
||||
const char *menu_label, const char *label, unsigned index)
|
||||
const char *menu_label, const char *label, unsigned idx)
|
||||
{
|
||||
setting_data_get_label(type_str, type_str_size, w,
|
||||
type, menu_label, label, index);
|
||||
type, menu_label, label, idx);
|
||||
}
|
||||
|
||||
static void menu_common_list_insert(void *data,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t index)
|
||||
unsigned type, size_t idx)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
list->list[index].actiondata = (menu_file_list_cbs_t*)
|
||||
list->list[idx].actiondata = (menu_file_list_cbs_t*)
|
||||
calloc(1, sizeof(menu_file_list_cbs_t));
|
||||
|
||||
if (!list->list[index].actiondata)
|
||||
if (!list->list[idx].actiondata)
|
||||
{
|
||||
RARCH_ERR("Action data could not be allocated.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
menu_entries_cbs_init(list, path, label, type, index);
|
||||
menu_entries_cbs_init(list, path, label, type, idx);
|
||||
}
|
||||
|
||||
static void menu_common_list_delete(void *data, size_t index,
|
||||
static void menu_common_list_delete(void *data, size_t idx,
|
||||
size_t list_size)
|
||||
{
|
||||
menu_file_list_cbs_t *cbs = NULL;
|
||||
@ -710,7 +710,7 @@ static void menu_common_list_delete(void *data, size_t index,
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
cbs = (menu_file_list_cbs_t*)list->list[index].actiondata;
|
||||
cbs = (menu_file_list_cbs_t*)list->list[idx].actiondata;
|
||||
|
||||
if (cbs)
|
||||
{
|
||||
@ -718,9 +718,9 @@ static void menu_common_list_delete(void *data, size_t index,
|
||||
cbs->action_ok = NULL;
|
||||
cbs->action_toggle = NULL;
|
||||
cbs->action_deferred_push = NULL;
|
||||
free(list->list[index].actiondata);
|
||||
free(list->list[idx].actiondata);
|
||||
}
|
||||
list->list[index].actiondata = NULL;
|
||||
list->list[idx].actiondata = NULL;
|
||||
}
|
||||
|
||||
static void menu_common_list_clear(void *data)
|
||||
|
@ -498,11 +498,11 @@ static void rmenu_xui_list_insert(void *data,
|
||||
XuiListSetText(m_menulist, list_size, buf);
|
||||
}
|
||||
|
||||
static void rmenu_xui_list_delete(void *data, size_t index,
|
||||
static void rmenu_xui_list_delete(void *data, size_t idx,
|
||||
size_t list_size)
|
||||
{
|
||||
(void)data;
|
||||
(void)index;
|
||||
(void)idx;
|
||||
XuiListDeleteItems(m_menulist, 0, list_size);
|
||||
}
|
||||
|
||||
|
@ -914,7 +914,7 @@ static void xmb_list_insert(void *data,
|
||||
node->y = iy;
|
||||
}
|
||||
|
||||
static void xmb_list_delete(void *data, size_t index,
|
||||
static void xmb_list_delete(void *data, size_t idx,
|
||||
size_t list_size)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
@ -922,9 +922,9 @@ static void xmb_list_delete(void *data, size_t index,
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
if (list->list[index].userdata)
|
||||
free(list->list[index].userdata);
|
||||
list->list[index].userdata = NULL;
|
||||
if (list->list[idx].userdata)
|
||||
free(list->list[idx].userdata);
|
||||
list->list[idx].userdata = NULL;
|
||||
}
|
||||
|
||||
static void xmb_list_clear(void *data)
|
||||
|
@ -238,7 +238,7 @@ void menu_free(void *data)
|
||||
free(data);
|
||||
}
|
||||
|
||||
void menu_ticker_line(char *buf, size_t len, unsigned index,
|
||||
void menu_ticker_line(char *buf, size_t len, unsigned idx,
|
||||
const char *str, bool selected)
|
||||
{
|
||||
size_t str_len = strlen(str);
|
||||
@ -259,7 +259,7 @@ void menu_ticker_line(char *buf, size_t len, unsigned index,
|
||||
{
|
||||
/* Wrap long strings in options with some kind of ticker line. */
|
||||
unsigned ticker_period = 2 * (str_len - len) + 4;
|
||||
unsigned phase = index % ticker_period;
|
||||
unsigned phase = idx % ticker_period;
|
||||
|
||||
unsigned phase_left_stop = 2;
|
||||
unsigned phase_left_moving = phase_left_stop + (str_len - len);
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
|
||||
void menu_entries_cbs_init(void *data,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t index);
|
||||
unsigned type, size_t idx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ static void menu_key_end_line(void *data)
|
||||
static void menu_search_callback(void *userdata, const char *str)
|
||||
{
|
||||
menu_handle_t *menu = (menu_handle_t*)userdata;
|
||||
size_t index;
|
||||
size_t idx;
|
||||
|
||||
if (str && *str && file_list_search(menu->menu_list->selection_buf, str, &index))
|
||||
menu_navigation_set(menu, index);
|
||||
if (str && *str && file_list_search(menu->menu_list->selection_buf, str, &idx))
|
||||
menu_navigation_set(menu, idx);
|
||||
|
||||
menu_key_end_line(menu);
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ size_t menu_list_get_stack_size(menu_list_t *list)
|
||||
return file_list_get_size(list->menu_stack);
|
||||
}
|
||||
|
||||
void menu_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
void menu_list_get_at_offset(const file_list_t *list, size_t idx,
|
||||
const char **path, const char **label, unsigned *file_type)
|
||||
{
|
||||
file_list_get_at_offset(list, index, path, label, file_type);
|
||||
file_list_get_at_offset(list, idx, path, label, file_type);
|
||||
}
|
||||
|
||||
size_t menu_list_get_size(menu_list_t *list)
|
||||
@ -103,10 +103,10 @@ void menu_list_get_last_stack(const menu_list_t *list,
|
||||
file_list_get_last(list->menu_stack, path, label, file_type);
|
||||
}
|
||||
|
||||
void *menu_list_get_actiondata_at_offset(const file_list_t *list, size_t index)
|
||||
void *menu_list_get_actiondata_at_offset(const file_list_t *list, size_t idx)
|
||||
{
|
||||
if (list)
|
||||
return file_list_get_actiondata_at_offset(list, index);
|
||||
return file_list_get_actiondata_at_offset(list, idx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -281,16 +281,16 @@ void menu_list_push_stack_refresh(menu_list_t *list,
|
||||
driver.menu->need_refresh = true;
|
||||
}
|
||||
|
||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
||||
const char *alt)
|
||||
{
|
||||
file_list_set_alt_at_offset(list, index, alt);
|
||||
file_list_set_alt_at_offset(list, idx, alt);
|
||||
}
|
||||
|
||||
void menu_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
void menu_list_get_alt_at_offset(const file_list_t *list, size_t idx,
|
||||
const char **alt)
|
||||
{
|
||||
file_list_get_alt_at_offset(list, index, alt);
|
||||
file_list_get_alt_at_offset(list, idx, alt);
|
||||
}
|
||||
|
||||
void menu_list_sort_on_alt(file_list_t *list)
|
||||
|
@ -48,10 +48,10 @@ void menu_list_pop_stack(menu_list_t *list);
|
||||
void menu_list_pop_stack_by_needle(menu_list_t *list,
|
||||
const char *needle);
|
||||
|
||||
void menu_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
void menu_list_get_at_offset(const file_list_t *list, size_t idx,
|
||||
const char **path, const char **label, unsigned *file_type);
|
||||
|
||||
void *menu_list_get_actiondata_at_offset(const file_list_t *list, size_t index);
|
||||
void *menu_list_get_actiondata_at_offset(const file_list_t *list, size_t idx);
|
||||
|
||||
size_t menu_list_get_stack_size(menu_list_t *list);
|
||||
|
||||
@ -87,10 +87,10 @@ void menu_list_push_stack_refresh(menu_list_t *list,
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t directory_ptr);
|
||||
|
||||
void menu_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
void menu_list_get_alt_at_offset(const file_list_t *list, size_t idx,
|
||||
const char **alt);
|
||||
|
||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,
|
||||
const char *alt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user