Refactor menu_entries_common_is_settings_entry

This commit is contained in:
twinaphex 2015-06-07 23:55:57 +02:00
parent 44938ed1ef
commit 295025eba6
6 changed files with 9 additions and 11 deletions

View File

@ -130,11 +130,9 @@ int cb_core_updater_download(void *data, size_t len)
}
#endif
int menu_entries_common_is_settings_entry(const char *label)
int menu_entries_common_is_settings_entry(uint32_t label_hash)
{
uint32_t hash = djb2_calculate(label);
switch (hash)
switch (label_hash)
{
case MENU_LABEL_DRIVER_SETTINGS:
case MENU_LABEL_CORE_SETTINGS:

View File

@ -45,7 +45,7 @@ int action_right_cheat(unsigned type, const char *label,
void menu_entries_common_load_content(bool persist);
int menu_entries_common_is_settings_entry(const char *label);
int menu_entries_common_is_settings_entry(uint32_t label_hash);
int menu_entries_cbs_init_bind_left(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,

View File

@ -645,7 +645,7 @@ int menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
if ((strlen(elem1) != 0) && !!strcmp(elem0, elem1))
{
if (menu_entries_common_is_settings_entry(elem0))
if (menu_entries_common_is_settings_entry(label_hash))
{
if (!settings->menu.collapse_subgroups_enable)
{

View File

@ -350,7 +350,7 @@ static int menu_entries_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *c
if (label)
{
if (menu_entries_common_is_settings_entry(elem0))
if (menu_entries_common_is_settings_entry(label_hash))
{
cbs->action_left = action_left_scroll;
return 0;

View File

@ -422,7 +422,7 @@ static int menu_entries_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *
if (label)
{
if (menu_entries_common_is_settings_entry(elem0))
if (menu_entries_common_is_settings_entry(label_hash))
{
cbs->action_right = action_right_scroll;
return 0;

View File

@ -70,11 +70,13 @@ static int action_get_title_default(const char *path, const char *label,
string_list_free(list_path);
}
hash = djb2_calculate(label);
#if 0
RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1);
#endif
if (menu_entries_common_is_settings_entry(label) == 1)
if (menu_entries_common_is_settings_entry(hash) == 1)
{
strlcpy(s, string_to_upper(elem0), len);
if (elem1[0] != '\0')
@ -85,8 +87,6 @@ static int action_get_title_default(const char *path, const char *label,
return 0;
}
hash = djb2_calculate(label);
switch (hash)
{
case MENU_LABEL_DEFERRED_DATABASE_MANAGER_LIST: