Skip to content

Commit

Permalink
(configuration.c) Cleanups/remove some redundant char buffers
Browse files Browse the repository at this point in the history
(rcheevos) Fix warning
  • Loading branch information
LibretroAdmin committed Jan 17, 2025
1 parent e2c8e98 commit 16209a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
53 changes: 18 additions & 35 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -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));
Expand Down Expand Up @@ -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(
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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)))
{
Expand All @@ -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)))
{
Expand Down Expand Up @@ -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;
Expand All @@ -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)))
{
Expand Down Expand Up @@ -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))
{
Expand Down
4 changes: 2 additions & 2 deletions deps/rcheevos/src/rcheevos/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 16209a0

Please sign in to comment.