mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
(Menu) Cut down on strcmp usage in menu_input.c
This commit is contained in:
parent
6f1e5a81be
commit
d6a17a97de
@ -2109,7 +2109,8 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
const char *label = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_displaylist_info_t info = {0};
|
||||
uint32_t hash_value = djb2_calculate(label);
|
||||
uint32_t hash_value = 0;
|
||||
|
||||
|
||||
menu_list_get_last_stack(menu->menu_list, &path, &label, &type);
|
||||
|
||||
@ -2119,6 +2120,8 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
strlcpy(info.path, path, sizeof(info.path));
|
||||
strlcpy(info.label, label, sizeof(info.label));
|
||||
|
||||
hash_value = djb2_calculate(label);
|
||||
|
||||
return menu_displaylist_deferred_push(&info, hash_value);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <rhash.h>
|
||||
|
||||
#include "menu_input.h"
|
||||
#include "menu.h"
|
||||
#include "menu_entry.h"
|
||||
@ -135,12 +138,20 @@ void menu_input_st_string_callback(void *userdata, const char *str)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(menu->keyboard.label_setting, "video_shader_preset_save_as"))
|
||||
menu_shader_manager_save_preset(str, false);
|
||||
else if (!strcmp(menu->keyboard.label_setting, "remap_file_save_as"))
|
||||
input_remapping_save_file(str);
|
||||
else if (!strcmp(menu->keyboard.label_setting, "cheat_file_save_as"))
|
||||
cheat_manager_save(global->cheat, str);
|
||||
uint32_t hash_label = djb2_calculate(menu->keyboard.label_setting);
|
||||
|
||||
switch (hash_label)
|
||||
{
|
||||
case MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS:
|
||||
menu_shader_manager_save_preset(str, false);
|
||||
break;
|
||||
case MENU_LABEL_REMAP_FILE_SAVE_AS:
|
||||
input_remapping_save_file(str);
|
||||
break;
|
||||
case MENU_LABEL_CHEAT_FILE_SAVE_AS:
|
||||
cheat_manager_save(global->cheat, str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user