From b8eba00a7e4297a676802c1021635952c0a13236 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 1 Dec 2015 02:46:43 +0100 Subject: [PATCH] Reduce scope of global->cheat --- cheats.c | 4 +++- cheats.h | 2 +- menu/menu_input.c | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cheats.c b/cheats.c index 1f916eb6c0..0c4e479e85 100644 --- a/cheats.c +++ b/cheats.c @@ -107,7 +107,7 @@ void cheat_manager_set_code(cheat_manager_t *handle, unsigned i, const char *str * * Returns: true (1) if successful, otherwise false (0). **/ -bool cheat_manager_save(cheat_manager_t *handle, const char *path) +bool cheat_manager_save(const char *path) { bool ret; unsigned i; @@ -115,6 +115,8 @@ bool cheat_manager_save(cheat_manager_t *handle, const char *path) char buf[PATH_MAX_LENGTH] = {0}; char cheats_file[PATH_MAX_LENGTH] = {0}; settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + cheat_manager_t *handle = global->cheat; fill_pathname_join(buf, settings->cheat_database, path, sizeof(buf)); diff --git a/cheats.h b/cheats.h index 6d3a0ac32e..eb2244749b 100644 --- a/cheats.h +++ b/cheats.h @@ -39,7 +39,7 @@ cheat_manager_t *cheat_manager_load(const char *path); * * Returns: true (1) if successful, otherwise false (0). **/ -bool cheat_manager_save(cheat_manager_t *handle, const char *path); +bool cheat_manager_save(const char *path); bool cheat_manager_realloc(cheat_manager_t *handle, unsigned new_size); diff --git a/menu/menu_input.c b/menu/menu_input.c index 57c15cf3b3..5289127fde 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -373,7 +373,6 @@ void menu_input_st_string_callback(void *userdata, const char *str) { rarch_setting_t *setting = NULL; const char *label = NULL; - global_t *global = global_get_ptr(); menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL_SETTING, &label); @@ -394,7 +393,7 @@ void menu_input_st_string_callback(void *userdata, const char *str) menu_shader_manager_save_preset(str, false); break; case MENU_LABEL_CHEAT_FILE_SAVE_AS: - cheat_manager_save(global->cheat, str); + cheat_manager_save(str); break; } }