(configuration.c) Cleanups/remove some redundant char buffers

(rcheevos) Fix warning
This commit is contained in:
LibretroAdmin 2025-01-17 12:32:54 +01:00
parent e2c8e98be0
commit 16209a0936
2 changed files with 20 additions and 37 deletions

View File

@ -4489,29 +4489,15 @@ bool config_load_override(void *data)
bool config_load_override_file(const char *config_path)
{
char config_directory[DIR_MAX_LENGTH];
bool should_append = false;
bool show_notification = true;
settings_t *settings = config_st;
config_directory[0] = '\0';
settings_t *settings = config_st;
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
/* Get base config directory */
fill_pathname_application_special(config_directory,
sizeof(config_directory),
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
if (path_is_valid(config_path))
{
path_set(RARCH_PATH_CONFIG_OVERRIDE, config_path);
should_append = true;
}
if (!should_append)
if (!path_is_valid(config_path))
return false;
path_set(RARCH_PATH_CONFIG_OVERRIDE, config_path);
/* Re-load the configuration with any overrides
* that might have been found */
@ -4523,8 +4509,7 @@ bool config_load_override_file(const char *config_path)
path_get(RARCH_PATH_CONFIG), settings))
return false;
if (settings->bools.notification_show_config_override_load
&& show_notification)
if (settings->bools.notification_show_config_override_load)
{
char msg[128];
size_t _len = strlcpy(msg, msg_hash_to_str(MSG_CONFIG_OVERRIDE_LOADED), sizeof(msg));
@ -6205,12 +6190,10 @@ static bool config_file_salamander_get_path(char *s, size_t len)
void config_load_file_salamander(void)
{
config_file_t *config = NULL;
char config_path[PATH_MAX_LENGTH];
char libretro_path[PATH_MAX_LENGTH];
config_file_t *config = NULL;
config_path[0] = '\0';
libretro_path[0] = '\0';
/* Get config file path */
if (!config_file_salamander_get_path(
@ -6227,10 +6210,10 @@ void config_load_file_salamander(void)
config_path);
if (config_get_path(config, "libretro_path",
libretro_path, sizeof(libretro_path))
&& !string_is_empty(libretro_path)
&& !string_is_equal(libretro_path, "builtin"))
path_set(RARCH_PATH_CORE, libretro_path);
config_path, sizeof(config_path))
&& !string_is_empty(config_path)
&& !string_is_equal(config_path, "builtin"))
path_set(RARCH_PATH_CORE, config_path);
config_file_free(config);
}
@ -6452,7 +6435,6 @@ void input_config_parse_joy_axis(
{
char tmp[64];
char key[64];
char key_label[64];
config_file_t *conf = (config_file_t*)conf_data;
struct retro_keybind *bind = (struct retro_keybind*)bind_data;
struct config_entry_list *tmp_a = NULL;
@ -6461,8 +6443,6 @@ void input_config_parse_joy_axis(
fill_pathname_join_delim(key, s,
"axis", '_', sizeof(key));
fill_pathname_join_delim(key_label, s,
"axis_label", '_', sizeof(key_label));
if (config_get_array(conf, key, tmp, sizeof(tmp)))
{
@ -6489,7 +6469,10 @@ void input_config_parse_joy_axis(
bind->orig_joyaxis = bind->joyaxis;
}
tmp_a = config_get_entry(conf, key_label);
fill_pathname_join_delim(key, s,
"axis_label", '_', sizeof(key));
tmp_a = config_get_entry(conf, key);
if (tmp_a && (!string_is_empty(tmp_a->value)))
{
@ -6543,7 +6526,6 @@ void input_config_parse_joy_button(
{
char tmp[64];
char key[64];
char key_label[64];
config_file_t *conf = (config_file_t*)data;
struct retro_keybind *bind = (struct retro_keybind*)bind_data;
struct config_entry_list *tmp_a = NULL;
@ -6552,8 +6534,6 @@ void input_config_parse_joy_button(
fill_pathname_join_delim(key, s,
"btn", '_', sizeof(key));
fill_pathname_join_delim(key_label, s,
"btn_label", '_', sizeof(key_label));
if (config_get_array(conf, key, tmp, sizeof(tmp)))
{
@ -6584,7 +6564,10 @@ void input_config_parse_joy_button(
}
}
tmp_a = config_get_entry(conf, key_label);
fill_pathname_join_delim(key, s,
"btn_label", '_', sizeof(key));
tmp_a = config_get_entry(conf, key);
if (tmp_a && !string_is_empty(tmp_a->value))
{

View File

@ -316,7 +316,7 @@ int rc_runtime_activate_lboard(rc_runtime_t* self, uint32_t id, const char* mema
rc_lboard_t* lboard;
rc_parse_state_t parse;
rc_runtime_lboard_t* runtime_lboard;
int size;
int32_t size;
uint32_t i;
if (memaddr == 0)
@ -834,7 +834,7 @@ void rc_runtime_invalidate_address(rc_runtime_t* self, uint32_t address) {
}
}
void rc_runtime_validate_addresses(rc_runtime_t* self, rc_runtime_event_handler_t event_handler,
void rc_runtime_validate_addresses(rc_runtime_t* self, rc_runtime_event_handler_t event_handler,
rc_runtime_validate_address_t validate_handler) {
rc_memref_t** last_memref = &self->memrefs;
rc_memref_t* memref = self->memrefs;