Get rid of more strcmps

This commit is contained in:
twinaphex 2015-06-05 09:31:07 +02:00
parent 0eacc9ff30
commit 6f842cedd3
2 changed files with 34 additions and 31 deletions

View File

@ -41,6 +41,7 @@ extern "C" {
#define MENU_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_MAX_USERS 0xbfcba816U #define MENU_LABEL_DEFERRED_CURSOR_MANAGER_LIST_RDB_ENTRY_MAX_USERS 0xbfcba816U
#define MENU_LABEL_DEFERRED_RDB_ENTRY_DETAIL 0xc35416c0U #define MENU_LABEL_DEFERRED_RDB_ENTRY_DETAIL 0xc35416c0U
#define MENU_LABEL_DEFERRED_CORE_LIST 0xf157d289U #define MENU_LABEL_DEFERRED_CORE_LIST 0xf157d289U
#define MENU_LABEL_DEFERRED_CORE_UPDATER_LIST 0xbd4d493dU
#define MENU_LABEL_CONFIGURATIONS 0x3e930a50U #define MENU_LABEL_CONFIGURATIONS 0x3e930a50U
#define MENU_LABEL_DISK_IMAGE_APPEND 0x5af7d709U #define MENU_LABEL_DISK_IMAGE_APPEND 0x5af7d709U
#define MENU_LABEL_PERFORMANCE_COUNTERS 0xd8ab5049U #define MENU_LABEL_PERFORMANCE_COUNTERS 0xd8ab5049U
@ -64,7 +65,6 @@ extern "C" {
#define MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS 0x7836a8caU #define MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS 0x7836a8caU
#define MENU_LABEL_DATABASE_MANAGER_LIST 0x7f853d8fU #define MENU_LABEL_DATABASE_MANAGER_LIST 0x7f853d8fU
#define MENU_LABEL_CURSOR_MANAGER_LIST 0xa969e378U #define MENU_LABEL_CURSOR_MANAGER_LIST 0xa969e378U
#define MENU_LABEL_DEFERRED_CORE_UPDATER_LIST 0xbd4d493dU
#define MENU_LABEL_VIDEO_SHADER_PASS 0x4fa31028U #define MENU_LABEL_VIDEO_SHADER_PASS 0x4fa31028U
#define MENU_LABEL_VIDEO_SHADER_PRESET 0xc5d3bae4U #define MENU_LABEL_VIDEO_SHADER_PRESET 0xc5d3bae4U
#define MENU_LABEL_CHEAT_FILE_LOAD 0x57336148U #define MENU_LABEL_CHEAT_FILE_LOAD 0x57336148U

View File

@ -14,6 +14,8 @@
*/ */
#include <file/file_path.h> #include <file/file_path.h>
#include <rhash.h>
#include "menu.h" #include "menu.h"
#include "menu_displaylist.h" #include "menu_displaylist.h"
#include "menu_entries_cbs.h" #include "menu_entries_cbs.h"
@ -454,6 +456,7 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
const char *elem0, const char *elem1) const char *elem0, const char *elem1)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
uint32_t hash = djb2_calculate(label);
if (!cbs) if (!cbs)
return; return;
@ -472,39 +475,39 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
} }
} }
if (strstr(label, "deferred_rdb_entry_detail")) if (hash == MENU_LABEL_DEFERRED_RDB_ENTRY_DETAIL)
cbs->action_deferred_push = deferred_push_rdb_entry_detail; cbs->action_deferred_push = deferred_push_rdb_entry_detail;
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
else if (!strcmp(label, "deferred_core_updater_list")) else if (hash == MENU_LABEL_DEFERRED_CORE_UPDATER_LIST)
cbs->action_deferred_push = deferred_push_core_updater_list; cbs->action_deferred_push = deferred_push_core_updater_list;
#endif #endif
else if (!strcmp(label, "history_list")) else if (hash == MENU_LABEL_HISTORY_LIST)
cbs->action_deferred_push = deferred_push_history_list; cbs->action_deferred_push = deferred_push_history_list;
else if (!strcmp(label, "database_manager_list")) else if (hash == MENU_LABEL_DATABASE_MANAGER_LIST)
cbs->action_deferred_push = deferred_push_database_manager_list; cbs->action_deferred_push = deferred_push_database_manager_list;
else if (!strcmp(label, "cursor_manager_list")) else if (hash == MENU_LABEL_CURSOR_MANAGER_LIST)
cbs->action_deferred_push = deferred_push_cursor_manager_list; cbs->action_deferred_push = deferred_push_cursor_manager_list;
else if (!strcmp(label, "cheat_file_load")) else if (hash == MENU_LABEL_CHEAT_FILE_LOAD)
cbs->action_deferred_push = deferred_push_cheat_file_load; cbs->action_deferred_push = deferred_push_cheat_file_load;
else if (!strcmp(label, "remap_file_load")) else if (hash == MENU_LABEL_REMAP_FILE_LOAD)
cbs->action_deferred_push = deferred_push_remap_file_load; cbs->action_deferred_push = deferred_push_remap_file_load;
else if (!strcmp(label, "record_config")) else if (!strcmp(label, "record_config"))
cbs->action_deferred_push = deferred_push_record_configfile; cbs->action_deferred_push = deferred_push_record_configfile;
else if (!strcmp(label, "content_actions")) else if (!strcmp(label, "content_actions"))
cbs->action_deferred_push = deferred_push_content_actions; cbs->action_deferred_push = deferred_push_content_actions;
else if (!strcmp(label, "shader_options")) else if (hash == MENU_LABEL_SHADER_OPTIONS)
cbs->action_deferred_push = deferred_push_shader_options; cbs->action_deferred_push = deferred_push_shader_options;
else if (!strcmp(label, "video_options")) else if (hash == MENU_LABEL_VIDEO_OPTIONS)
cbs->action_deferred_push = deferred_push_video_options; cbs->action_deferred_push = deferred_push_video_options;
else if (!strcmp(label, "options")) else if (!strcmp(label, "options"))
cbs->action_deferred_push = deferred_push_options; cbs->action_deferred_push = deferred_push_options;
else if (!strcmp(label, "management")) else if (hash == MENU_LABEL_MANAGEMENT)
cbs->action_deferred_push = deferred_push_management_options; cbs->action_deferred_push = deferred_push_management_options;
else if (type == MENU_SETTING_GROUP) else if (type == MENU_SETTING_GROUP)
cbs->action_deferred_push = deferred_push_category; cbs->action_deferred_push = deferred_push_category;
else if (type == MENU_FILE_PLAYLIST_COLLECTION) else if (type == MENU_FILE_PLAYLIST_COLLECTION)
cbs->action_deferred_push = deferred_push_rdb_collection; cbs->action_deferred_push = deferred_push_rdb_collection;
else if (!strcmp(label, "deferred_core_list") || else if ((hash == MENU_LABEL_DEFERRED_CORE_LIST) ||
!strcmp(label, "deferred_core_list_set")) !strcmp(label, "deferred_core_list_set"))
cbs->action_deferred_push = deferred_push_core_list_deferred; cbs->action_deferred_push = deferred_push_core_list_deferred;
else if (!strcmp(label, "deferred_video_filter")) else if (!strcmp(label, "deferred_video_filter"))
@ -532,51 +535,51 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs,
!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear") !strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear")
) )
cbs->action_deferred_push = deferred_push_cursor_manager_list_deferred_query_subsearch; cbs->action_deferred_push = deferred_push_cursor_manager_list_deferred_query_subsearch;
else if (!strcmp(label, "core_information")) else if (hash == MENU_LABEL_CORE_INFORMATION)
cbs->action_deferred_push = deferred_push_core_information; cbs->action_deferred_push = deferred_push_core_information;
else if (!strcmp(label, "system_information")) else if (hash == MENU_LABEL_SYSTEM_INFORMATION)
cbs->action_deferred_push = deferred_push_system_information; cbs->action_deferred_push = deferred_push_system_information;
else if (!strcmp(label, "performance_counters")) else if (hash == MENU_LABEL_PERFORMANCE_COUNTERS)
cbs->action_deferred_push = deferred_push_performance_counters; cbs->action_deferred_push = deferred_push_performance_counters;
else if (!strcmp(label, "core_counters")) else if (hash == MENU_LABEL_CORE_COUNTERS)
cbs->action_deferred_push = deferred_push_core_counters; cbs->action_deferred_push = deferred_push_core_counters;
else if (!strcmp(label, "video_shader_preset_parameters")) else if (hash == MENU_LABEL_VIDEO_SHADER_PRESET_PARAMETERS)
cbs->action_deferred_push = deferred_push_video_shader_preset_parameters; cbs->action_deferred_push = deferred_push_video_shader_preset_parameters;
else if (!strcmp(label, "video_shader_parameters")) else if (hash == MENU_LABEL_VIDEO_SHADER_PARAMETERS)
cbs->action_deferred_push = deferred_push_video_shader_parameters; cbs->action_deferred_push = deferred_push_video_shader_parameters;
else if (!strcmp(label, "settings")) else if (!strcmp(label, "settings"))
cbs->action_deferred_push = deferred_push_settings; cbs->action_deferred_push = deferred_push_settings;
else if (!strcmp(label, "frontend_counters")) else if (hash == MENU_LABEL_FRONTEND_COUNTERS)
cbs->action_deferred_push = deferred_push_frontend_counters; cbs->action_deferred_push = deferred_push_frontend_counters;
else if (!strcmp(label, "core_options")) else if (hash == MENU_LABEL_CORE_OPTIONS)
cbs->action_deferred_push = deferred_push_core_options; cbs->action_deferred_push = deferred_push_core_options;
else if (!strcmp(label, "core_cheat_options")) else if (hash == MENU_LABEL_CORE_CHEAT_OPTIONS)
cbs->action_deferred_push = deferred_push_core_cheat_options; cbs->action_deferred_push = deferred_push_core_cheat_options;
else if (!strcmp(label, "core_input_remapping_options")) else if (hash == MENU_LABEL_CORE_INPUT_REMAPPING_OPTIONS)
cbs->action_deferred_push = deferred_push_core_input_remapping_options; cbs->action_deferred_push = deferred_push_core_input_remapping_options;
else if (!strcmp(label, "disk_options")) else if (hash == MENU_LABEL_DISK_OPTIONS)
cbs->action_deferred_push = deferred_push_disk_options; cbs->action_deferred_push = deferred_push_disk_options;
else if (!strcmp(label, "core_list")) else if (hash == MENU_LABEL_CORE_LIST)
cbs->action_deferred_push = deferred_push_core_list; cbs->action_deferred_push = deferred_push_core_list;
else if (!strcmp(label, "content_collection_list")) else if (!strcmp(label, "content_collection_list"))
cbs->action_deferred_push = deferred_push_content_collection_list; cbs->action_deferred_push = deferred_push_content_collection_list;
else if (!strcmp(label, "configurations")) else if (hash == MENU_LABEL_CONFIGURATIONS)
cbs->action_deferred_push = deferred_push_configurations; cbs->action_deferred_push = deferred_push_configurations;
else if (!strcmp(label, "video_shader_preset")) else if (hash == MENU_LABEL_VIDEO_SHADER_PRESET)
cbs->action_deferred_push = deferred_push_video_shader_preset; cbs->action_deferred_push = deferred_push_video_shader_preset;
else if (!strcmp(label, "video_shader_pass")) else if (hash == MENU_LABEL_VIDEO_SHADER_PASS)
cbs->action_deferred_push = deferred_push_video_shader_pass; cbs->action_deferred_push = deferred_push_video_shader_pass;
else if (!strcmp(label, "video_filter")) else if (hash == MENU_LABEL_VIDEO_FILTER)
cbs->action_deferred_push = deferred_push_video_filter; cbs->action_deferred_push = deferred_push_video_filter;
else if (!strcmp(label, "menu_wallpaper")) else if (!strcmp(label, "menu_wallpaper"))
cbs->action_deferred_push = deferred_push_images; cbs->action_deferred_push = deferred_push_images;
else if (!strcmp(label, "audio_dsp_plugin")) else if (hash == MENU_LABEL_AUDIO_DSP_PLUGIN)
cbs->action_deferred_push = deferred_push_audio_dsp_plugin; cbs->action_deferred_push = deferred_push_audio_dsp_plugin;
else if (!strcmp(label, "input_overlay")) else if (hash == MENU_LABEL_INPUT_OVERLAY)
cbs->action_deferred_push = deferred_push_input_overlay; cbs->action_deferred_push = deferred_push_input_overlay;
else if (!strcmp(label, "input_osk_overlay")) else if (!strcmp(label, "input_osk_overlay"))
cbs->action_deferred_push = deferred_push_input_osk_overlay; cbs->action_deferred_push = deferred_push_input_osk_overlay;
else if (!strcmp(label, "video_font_path")) else if (hash == MENU_LABEL_VIDEO_FONT_PATH)
cbs->action_deferred_push = deferred_push_video_font_path; cbs->action_deferred_push = deferred_push_video_font_path;
else if (!strcmp(label, "content_history_path")) else if (!strcmp(label, "content_history_path"))
cbs->action_deferred_push = deferred_push_content_history_path; cbs->action_deferred_push = deferred_push_content_history_path;