Refactor some code

This commit is contained in:
twinaphex 2015-10-18 20:34:34 +02:00
parent ff8f587c30
commit 6cd2173382
4 changed files with 9 additions and 15 deletions

View File

@ -34,16 +34,15 @@ static void menu_cbs_init_log(const char *entry_label, const char *bind_label, c
}
void menu_cbs_init(void *data,
menu_file_list_cbs_t *cbs,
const char *path, const char *label,
unsigned type, size_t idx)
{
char elem0[PATH_MAX_LENGTH];
char elem1[PATH_MAX_LENGTH];
const char *repr_label = NULL;
rarch_setting_t *setting = NULL;
struct string_list *str_list = NULL;
const char *menu_label = NULL;
menu_file_list_cbs_t *cbs = NULL;
int ret = 0;
uint32_t label_hash = 0;
uint32_t menu_label_hash = 0;
@ -51,16 +50,6 @@ void menu_cbs_init(void *data,
if (!list)
return;
cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, idx);
if (!cbs)
return;
setting = menu_setting_find(label);
if (setting)
cbs->setting = setting;
elem0[0] = '\0';
elem1[0] = '\0';

View File

@ -190,6 +190,7 @@ int action_scan_file(const char *path,
const char *label, unsigned type, size_t idx);
void menu_cbs_init(void *data,
menu_file_list_cbs_t *cbs,
const char *path, const char *label,
unsigned type, size_t idx);

View File

@ -233,6 +233,7 @@ static void menu_list_push(file_list_t *list,
size_t idx;
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_file_list_cbs_t *cbs = NULL;
rarch_setting_t *setting = NULL;
if (!list || !label)
return;
@ -251,7 +252,12 @@ static void menu_list_push(file_list_t *list,
return;
file_list_set_actiondata(list, idx, cbs);
menu_cbs_init(list, path, label, type, idx);
setting = menu_setting_find(label);
cbs->setting = (setting) ? setting : NULL;
menu_cbs_init(list, cbs, path, label, type, idx);
}
void menu_list_set_alt_at_offset(file_list_t *list, size_t idx,

View File

@ -43,8 +43,6 @@ int menu_entry_go_back(void)
return 0;
}
enum menu_entry_type menu_entry_get_type(uint32_t i)
{
rarch_setting_t *setting = menu_entries_get_setting(i);