diff --git a/command.c b/command.c index 99db02b10f..f01f2bd4bc 100644 --- a/command.c +++ b/command.c @@ -222,11 +222,11 @@ static bool command_read_ram(const char *arg) static bool command_write_ram(const char *arg) { - cheevos_var_t var; - uint8_t * data; - unsigned nbytes; int i; char reply[256]; + cheevos_var_t var; + unsigned nbytes; + uint8_t * data = NULL; cheevos_parse_guest_addr(&var, strtoul(arg, (char**)&arg, 16)); data = cheevos_get_memory(&var); @@ -859,7 +859,7 @@ static void command_event_disk_control_set_eject(bool new_state, bool print_log) msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY)); } - if (*msg) + if (!string_is_empty(msg)) { if (error) RARCH_ERR("%s\n", msg); @@ -918,7 +918,7 @@ static void command_event_disk_control_set_index(unsigned idx) error = true; } - if (*msg) + if (!string_is_empty(msg)) { if (error) RARCH_ERR("%s\n", msg); @@ -1543,11 +1543,12 @@ void command_event_save_current_config(void) */ /* Flush out the core specific config. */ - if (*global->path.core_specific_config && - settings->core_specific_config) + if (!string_is_empty(global->path.core_specific_config) + && settings->core_specific_config) ret = config_save_file(global->path.core_specific_config); else ret = config_save_file(global->path.config); + if (ret) { snprintf(msg, sizeof(msg), "Saved new config to \"%s\".", @@ -2092,7 +2093,7 @@ bool command_event(enum event_command cmd, void *data) case CMD_EVENT_CORE_INFO_INIT: command_event(CMD_EVENT_CORE_INFO_DEINIT, NULL); - if (*settings->directory.libretro) + if (!string_is_empty(settings->directory.libretro)) core_info_init_list(); break; case CMD_EVENT_CORE_DEINIT: diff --git a/configuration.c b/configuration.c index 69d088345f..8666941525 100644 --- a/configuration.c +++ b/configuration.c @@ -901,7 +901,7 @@ static void config_set_defaults(void) g_defaults.dir.content_history, sizeof(settings->directory.content_history)); - if (*g_defaults.path.config) + if (!string_is_empty(g_defaults.path.config)) fill_pathname_expand_special(global->path.config, g_defaults.path.config, sizeof(global->path.config)); @@ -1949,7 +1949,7 @@ static void config_load_core_specific(void) #endif #ifdef HAVE_MENU - if (*settings->directory.menu_config) + if (!string_is_empty(settings->directory.menu_config)) { path_resolve_realpath(settings->directory.menu_config, sizeof(settings->directory.menu_config)); @@ -2277,14 +2277,14 @@ static void parse_config_file(void) bool ret = config_load_file((*global->path.config) ? global->path.config : NULL, false); - if (*global->path.config) + if (!string_is_empty(global->path.config)) { RARCH_LOG("Config: loading config from: %s.\n", global->path.config); } else { RARCH_LOG("Loading default config.\n"); - if (*global->path.config) + if (!string_is_empty(global->path.config)) RARCH_LOG("Config: found default config: %s.\n", global->path.config); } @@ -2466,7 +2466,7 @@ void config_load(void) global_t *global = global_get_ptr(); /* Flush out per-core configs before loading a new config. */ - if (*global->path.core_specific_config && + if (!string_is_empty(global->path.core_specific_config) && settings->config_save_on_exit && settings->core_specific_config) config_save_file(global->path.core_specific_config); diff --git a/file_path_special.c b/file_path_special.c index 966d7fa538..3b0118840a 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -121,7 +121,7 @@ void fill_pathname_abbreviate_special(char *out_path, for (i = 0; candidates[i]; i++) { - if (*candidates[i] && strstr(in_path, candidates[i]) == in_path) + if (!string_is_empty(candidates[i]) && strstr(in_path, candidates[i]) == in_path) { size_t src_size = strlcpy(out_path, notations[i], size); diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index b6955e5a04..3d3062bb4c 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -248,7 +248,7 @@ static void menu_action_setting_disp_set_label_shader_pass( if (!shader) return; - if (*shader->pass[pass].source.path) + if (!string_is_empty(shader->pass[pass].source.path)) fill_pathname_base(s, shader->pass[pass].source.path, len); #endif diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 65c8e84301..45d8612e11 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "menu_driver.h" #include "menu_shader.h" @@ -48,10 +49,10 @@ void menu_shader_manager_init(menu_handle_t *menu) if (global) { - if (*global->path.core_specific_config + if (!string_is_empty(global->path.core_specific_config) && settings->core_specific_config) config_path = global->path.core_specific_config; - else if (*global->path.config) + else if (!string_is_empty(global->path.config)) config_path = global->path.config; } @@ -288,7 +289,7 @@ void menu_shader_manager_save_preset( strlcpy(buffer, conf_path, sizeof(buffer)); } - if (*global->path.config) + if (!string_is_empty(global->path.config)) fill_pathname_basedir( config_directory, global->path.config, diff --git a/retroarch.c b/retroarch.c index 4c6a6615a1..4aa9aaa597 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1062,13 +1062,13 @@ static void retroarch_parse_input(int argc, char *argv[]) } } - if (!*global->subsystem && optind < argc) + if (string_is_empty(global->subsystem) && optind < argc) { /* We requested explicit ROM, so use PLAIN core type. */ retroarch_set_current_core_type(CORE_TYPE_PLAIN, false); retroarch_set_pathnames((const char*)argv[optind]); } - else if (*global->subsystem && optind < argc) + else if (!string_is_empty(global->subsystem) && optind < argc) { /* We requested explicit ROM, so use PLAIN core type. */ retroarch_set_current_core_type(CORE_TYPE_PLAIN, false); diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index c7744e1941..17b1c004b7 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -562,10 +562,10 @@ static bool task_overlay_resolve_targets(struct overlay *ol, for (i = 0; i < current->size; i++) { - const char *next = current->descs[i].next_index_name; ssize_t next_idx = 0; + const char *next = current->descs[i].next_index_name; - if (*next) + if (!string_is_empty(next)) { next_idx = task_overlay_find_index(ol, next, size);